diff options
-rw-r--r-- | TODO | 12 | ||||
m--------- | contrib/scintilla | 0 | ||||
-rw-r--r-- | src/core-commands.c | 24 | ||||
-rw-r--r-- | src/doc.c | 6 | ||||
-rw-r--r-- | src/help.c | 4 | ||||
-rw-r--r-- | src/interface-curses/interface.c | 7 | ||||
-rw-r--r-- | src/interface-gtk/interface.c | 7 | ||||
-rw-r--r-- | src/search.c | 22 | ||||
-rw-r--r-- | src/spawn.c | 4 |
9 files changed, 33 insertions, 53 deletions
@@ -4,14 +4,6 @@ Tasks: "edit" hook. Known Bugs: - * <Ix$> hangs after interruption. - These are apparently very costly calculations to make the caret - visible after each and every UNDO sent to Scintilla. - This is because it implicitly does a SCROLLCARET each time. - There are already optimizations but they don't work on undo - (see 8ef010da59743fcc4927c790f585ba414ec7b129). - It may be better to temporarily disable scrolling altogether and - enable it after every keypress. * The "lexer.test..." macros do not work with the unnamed buffer, so there should be a special test in .teco_ini. * After commands like ECcat /dev/zero$ result in OOM, @@ -117,7 +109,7 @@ Known Bugs: * Mac OS: The colors are screwed up with the terminal.tes color scheme (and with --no-profile) under Mac OS terminal emulators. This does not happen under Linux with Darling. - See https://github.com/rhaberkorn/sciteco/issues/8 + See https://github.com/rhaberkorn/sciteco/issues/12 Features: * Auto-indention could be implemented via context-sensitive @@ -434,6 +426,8 @@ Features: * AppImage for Linux * 64-bit Windows builds * Mac OS Arm64 builds either separately or via universal binary. + See https://codetinkering.com/switch-homebrew-arm-x86/ + Target flag: `-target arm64-apple-macos11` * Linux: Relocatable binaries instead of hardcoding the library path. This makes it possible to run builds installed via `make install DESTDIR=...` and will aid in creating AppImages. diff --git a/contrib/scintilla b/contrib/scintilla -Subproject 85ea187540b421d3d99c91019ed484c70d9d1d1 +Subproject de2ed1d4bfc55dcca30f74790a3b4f7931b0803 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); } @@ -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, @@ -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); |