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/core-commands.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/core-commands.c')
-rw-r--r-- | src/core-commands.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/src/core-commands.c b/src/core-commands.c index c58efc1..4d5b378 100644 --- a/src/core-commands.c +++ b/src/core-commands.c @@ -513,9 +513,9 @@ teco_state_start_jump(teco_machine_main_t *ctx, GError **error) if (teco_validate_pos(v)) { if (teco_current_doc_must_undo()) - undo__teco_interface_ssm(SCI_SETEMPTYSELECTION, + undo__teco_interface_ssm(SCI_GOTOPOS, teco_interface_ssm(SCI_GETCURRENTPOS, 0, 0), 0); - teco_interface_ssm(SCI_SETEMPTYSELECTION, v, 0); + teco_interface_ssm(SCI_GOTOPOS, v, 0); if (teco_machine_main_eval_colon(ctx)) teco_expressions_push(TECO_SUCCESS); @@ -535,9 +535,9 @@ teco_move_chars(teco_int_t n) if (!teco_validate_pos(pos + n)) return TECO_FAILURE; - teco_interface_ssm(SCI_SETEMPTYSELECTION, pos + n, 0); + teco_interface_ssm(SCI_GOTOPOS, pos + n, 0); if (teco_current_doc_must_undo()) - undo__teco_interface_ssm(SCI_SETEMPTYSELECTION, pos, 0); + undo__teco_interface_ssm(SCI_GOTOPOS, pos, 0); return TECO_SUCCESS; } @@ -603,11 +603,9 @@ teco_move_lines(teco_int_t n) if (!teco_validate_line(line)) return TECO_FAILURE; - /* avoids scrolling caret (expensive operation) */ - teco_interface_ssm(SCI_SETEMPTYSELECTION, - teco_interface_ssm(SCI_POSITIONFROMLINE, line, 0), 0); + teco_interface_ssm(SCI_GOTOLINE, line, 0); if (teco_current_doc_must_undo()) - undo__teco_interface_ssm(SCI_SETEMPTYSELECTION, pos, 0); + undo__teco_interface_ssm(SCI_GOTOPOS, pos, 0); return TECO_SUCCESS; } @@ -719,11 +717,11 @@ teco_state_start_word(teco_machine_main_t *ctx, GError **error) } if (v < 0) { if (teco_current_doc_must_undo()) - undo__teco_interface_ssm(SCI_SETEMPTYSELECTION, pos, 0); + undo__teco_interface_ssm(SCI_GOTOPOS, pos, 0); if (teco_machine_main_eval_colon(ctx)) teco_expressions_push(TECO_SUCCESS); } else { - teco_interface_ssm(SCI_SETEMPTYSELECTION, pos, 0); + teco_interface_ssm(SCI_GOTOPOS, pos, 0); if (!teco_machine_main_eval_colon(ctx)) { teco_error_move_set(error, "W"); return; @@ -771,14 +769,14 @@ teco_delete_words(teco_int_t n) if (n >= 0) { if (size != teco_interface_ssm(SCI_GETLENGTH, 0, 0)) { teco_interface_ssm(SCI_UNDO, 0, 0); - teco_interface_ssm(SCI_SETEMPTYSELECTION, pos, 0); + teco_interface_ssm(SCI_GOTOPOS, pos, 0); } return TECO_FAILURE; } g_assert(size != teco_interface_ssm(SCI_GETLENGTH, 0, 0)); if (teco_current_doc_must_undo()) { - undo__teco_interface_ssm(SCI_SETEMPTYSELECTION, pos, 0); + undo__teco_interface_ssm(SCI_GOTOPOS, pos, 0); undo__teco_interface_ssm(SCI_UNDO, 0, 0); } teco_ring_dirtify(); @@ -924,7 +922,7 @@ teco_state_start_kill(teco_machine_main_t *ctx, const gchar *cmd, gboolean by_li if (teco_current_doc_must_undo()) { sptr_t pos = teco_interface_ssm(SCI_GETCURRENTPOS, 0, 0); - undo__teco_interface_ssm(SCI_SETEMPTYSELECTION, pos, 0); + undo__teco_interface_ssm(SCI_GOTOPOS, pos, 0); undo__teco_interface_ssm(SCI_UNDO, 0, 0); } |