aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2024-10-29 16:08:45 +0300
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2024-10-29 16:08:45 +0300
commit6d882a3fdd5b35181b301a2b1db32908c2b7953a (patch)
tree6e17828a6f31582428b051047e744839cae1cd94
parent2b6342cbb3e0c89bcd81c143c88a43ece55bc9db (diff)
downloadsciteco-6d882a3fdd5b35181b301a2b1db32908c2b7953a.tar.gz
fixed <N> (search all) crashes before invocations of <S> (closes #26)
* There was some boilerplate code missing in teco_state_search_all_initial(), that is present in teco_state_search_initial(). * Perhaps there should be a common function to avoid redundancies? * This will also fix the initialization of the string argument codepage for <N>.
-rw-r--r--src/search.c7
-rw-r--r--tests/testsuite.at1
2 files changed, 8 insertions, 0 deletions
diff --git a/src/search.c b/src/search.c
index 0d04895..14a8540 100644
--- a/src/search.c
+++ b/src/search.c
@@ -830,6 +830,13 @@ teco_state_search_all_initial(teco_machine_main_t *ctx, GError **error)
if (ctx->mode > TECO_MODE_NORMAL)
return TRUE;
+ teco_machine_stringbuilding_set_codepage(&ctx->expectstring.machine,
+ teco_interface_get_codepage());
+
+ if (G_UNLIKELY(!teco_search_qreg_machine))
+ teco_search_qreg_machine = teco_machine_qregspec_new(TECO_QREG_REQUIRED, ctx->qreg_table_locals,
+ ctx->parent.must_undo);
+
teco_undo_object_parameters_push(&teco_search_parameters);
teco_search_parameters.dot = teco_interface_ssm(SCI_GETCURRENTPOS, 0, 0);
diff --git a/tests/testsuite.at b/tests/testsuite.at
index aba51a5..01ca664 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -171,6 +171,7 @@ AT_CLEANUP
AT_SETUP([Search on new empty document])
AT_CHECK([$SCITECO -e ":@S/foo/\"S(0/0)'"], 0, ignore, ignore)
+AT_CHECK([$SCITECO -e ":@N/foo/\"S(0/0)'"], 0, ignore, ignore)
AT_CLEANUP
AT_SETUP([Memory limiting during spawning])