aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2023-04-18 12:11:55 +0300
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2023-04-18 12:11:55 +0300
commit941f48da6dde691a7800290cc729aaaacd051392 (patch)
tree1191a175e4c2f88f7a926413c6ed455d1f803d24 /src
parentf0d57d7676e2fed234a10d93f2737209e8007c2c (diff)
downloadsciteco-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')
-rw-r--r--src/core-commands.c24
-rw-r--r--src/doc.c6
-rw-r--r--src/help.c4
-rw-r--r--src/interface-curses/interface.c7
-rw-r--r--src/interface-gtk/interface.c7
-rw-r--r--src/search.c22
-rw-r--r--src/spawn.c4
7 files changed, 30 insertions, 44 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);
}
diff --git a/src/doc.c b/src/doc.c
index 2c56a64..a69896c 100644
--- a/src/doc.c
+++ b/src/doc.c
@@ -45,8 +45,7 @@ teco_doc_edit(teco_doc_t *ctx)
(sptr_t)teco_doc_get_scintilla(ctx));
teco_view_ssm(teco_qreg_view, SCI_SETFIRSTVISIBLELINE, ctx->first_line, 0);
teco_view_ssm(teco_qreg_view, SCI_SETXOFFSET, ctx->xoffset, 0);
- teco_view_ssm(teco_qreg_view, SCI_SETSELECTIONSTART, ctx->anchor, 0);
- teco_view_ssm(teco_qreg_view, SCI_SETSELECTIONEND, ctx->dot, 0);
+ teco_view_ssm(teco_qreg_view, SCI_SETSEL, ctx->anchor, (sptr_t)ctx->dot);
/*
* NOTE: Thanks to a custom Scintilla patch, se representations
@@ -65,8 +64,7 @@ teco_doc_undo_edit(teco_doc_t *ctx)
*/
//undo__teco_view_set_representations(teco_qreg_view);
- undo__teco_view_ssm(teco_qreg_view, SCI_SETSELECTIONEND, ctx->dot, 0);
- undo__teco_view_ssm(teco_qreg_view, SCI_SETSELECTIONSTART, ctx->anchor, 0);
+ undo__teco_view_ssm(teco_qreg_view, SCI_SETSEL, ctx->anchor, (sptr_t)ctx->dot);
undo__teco_view_ssm(teco_qreg_view, SCI_SETXOFFSET, ctx->xoffset, 0);
undo__teco_view_ssm(teco_qreg_view, SCI_SETFIRSTVISIBLELINE, ctx->first_line, 0);
undo__teco_view_ssm(teco_qreg_view, SCI_SETDOCPOINTER, 0,
diff --git a/src/help.c b/src/help.c
index 37dd5a6..e06bda4 100644
--- a/src/help.c
+++ b/src/help.c
@@ -308,9 +308,9 @@ teco_state_help_done(teco_machine_main_t *ctx, const teco_string_t *str, GError
* multiple topics in the same buffer without
* closing it first.
*/
- 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, topic->pos, 0);
+ teco_interface_ssm(SCI_GOTOPOS, topic->pos, 0);
return &teco_state_start;
}
diff --git a/src/interface-curses/interface.c b/src/interface-curses/interface.c
index 6e6fb75..ae0cb9a 100644
--- a/src/interface-curses/interface.c
+++ b/src/interface-curses/interface.c
@@ -1632,12 +1632,9 @@ teco_interface_event_loop_iter(void)
}
/*
- * We avoid Scintilla messages that scroll the caret during macro
- * execution since it has been benchmarked to be very a very costly operation.
+ * Scintilla has been patched to avoid any automatic scrolling since that
+ * has been benchmarked to be a very costly operation.
* Instead we do it only once after every keypress.
- *
- * FIXME: This could be in teco_cmdline_keypress() since it is common among
- * all interface implementations.
*/
teco_interface_ssm(SCI_SCROLLCARET, 0, 0);
diff --git a/src/interface-gtk/interface.c b/src/interface-gtk/interface.c
index 0271947..3dcabf5 100644
--- a/src/interface-gtk/interface.c
+++ b/src/interface-gtk/interface.c
@@ -897,12 +897,9 @@ teco_interface_handle_key_press(guint keyval, guint state, GError **error)
}
/*
- * We avoid Scintilla messages that scroll the caret during macro
- * execution since it has been benchmarked to be very a very costly operation.
+ * Scintilla has been patched to avoid any automatic scrolling since that
+ * has been benchmarked to be a very costly operation.
* Instead we do it only once after every keypress.
- *
- * FIXME: This could be in teco_cmdline_keypress() since it is common among
- * all interface implementations.
*/
teco_interface_ssm(SCI_SCROLLCARET, 0, 0);
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);
diff --git a/src/spawn.c b/src/spawn.c
index b4c59a9..97d0b21 100644
--- a/src/spawn.c
+++ b/src/spawn.c
@@ -297,9 +297,9 @@ teco_state_execute_done(teco_machine_main_t *ctx, const teco_string_t *str, GErr
if (!teco_spawn_ctx.register_argument) {
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, teco_spawn_ctx.to, 0);
+ teco_interface_ssm(SCI_GOTOPOS, teco_spawn_ctx.to, 0);
}
teco_interface_ssm(SCI_BEGINUNDOACTION, 0, 0);