diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2023-04-18 12:11:55 +0300 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2023-04-18 12:11:55 +0300 |
commit | 941f48da6dde691a7800290cc729aaaacd051392 (patch) | |
tree | 1191a175e4c2f88f7a926413c6ed455d1f803d24 /src/search.c | |
parent | f0d57d7676e2fed234a10d93f2737209e8007c2c (diff) | |
download | sciteco-941f48da6dde691a7800290cc729aaaacd051392.tar.gz |
no longer try to avoid automatic scrolling - this is patched out of Scintilla now
* The patch avoids all automatic scrolling consistently, including in SCI_UNDO.
This speads up Undo (especially after interruptions).
* Also, the patch disables a very costly and pointless (in SciTECO) algorithm that
effectively made <Ix$> uninterruptible.
* Effectively reverts large parts of 8ef010da59743fcc4927c790f585ba414ec7b129.
I have never liked using unintuitive Scintilla messages to avoid scrolling.
Diffstat (limited to 'src/search.c')
-rw-r--r-- | src/search.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/src/search.c b/src/search.c index 2ba5ba0..733eab9 100644 --- a/src/search.c +++ b/src/search.c @@ -541,11 +541,9 @@ teco_do_search(GRegex *re, gint from, gint to, gint *count, GError **error) } } - if (matched_from >= 0 && matched_to >= 0) { + if (matched_from >= 0 && matched_to >= 0) /* match success */ - teco_interface_ssm(SCI_SETSELECTIONSTART, matched_from, 0); - teco_interface_ssm(SCI_SETSELECTIONEND, matched_to, 0); - } + teco_interface_ssm(SCI_SETSEL, matched_from, matched_to); return TRUE; } @@ -556,12 +554,10 @@ teco_state_search_process(teco_machine_main_t *ctx, const teco_string_t *str, gs static const GRegexCompileFlags flags = G_REGEX_CASELESS | G_REGEX_MULTILINE | G_REGEX_DOTALL | G_REGEX_RAW; - if (teco_current_doc_must_undo()) { - undo__teco_interface_ssm(SCI_SETSELECTIONEND, - teco_interface_ssm(SCI_GETCURRENTPOS, 0, 0), 0); - undo__teco_interface_ssm(SCI_SETSELECTIONSTART, - teco_interface_ssm(SCI_GETANCHOR, 0, 0), 0); - } + if (teco_current_doc_must_undo()) + undo__teco_interface_ssm(SCI_SETSEL, + teco_interface_ssm(SCI_GETANCHOR, 0, 0), + teco_interface_ssm(SCI_GETCURRENTPOS, 0, 0)); teco_qreg_t *search_reg = teco_qreg_table_find(&teco_qreg_table_globals, "_", 1); g_assert(search_reg != NULL); @@ -652,7 +648,7 @@ teco_state_search_process(teco_machine_main_t *ctx, const teco_string_t *str, gs return TRUE; failure: - teco_interface_ssm(SCI_SETEMPTYSELECTION, teco_search_parameters.dot, 0); + teco_interface_ssm(SCI_GOTOPOS, teco_search_parameters.dot, 0); return TRUE; } @@ -902,8 +898,8 @@ teco_state_search_kill_done(teco_machine_main_t *ctx, const teco_string_t *str, gint anchor = teco_interface_ssm(SCI_GETANCHOR, 0, 0); if (teco_current_doc_must_undo()) - undo__teco_interface_ssm(SCI_SETEMPTYSELECTION, dot, 0); - teco_interface_ssm(SCI_SETEMPTYSELECTION, anchor, 0); + undo__teco_interface_ssm(SCI_GOTOPOS, dot, 0); + teco_interface_ssm(SCI_GOTOPOS, anchor, 0); teco_interface_ssm(SCI_DELETERANGE, teco_search_parameters.dot, anchor - teco_search_parameters.dot); |