diff options
| author | Robin Haberkorn <rhaberkorn@fmsbw.de> | 2025-11-21 22:39:01 +0100 |
|---|---|---|
| committer | Robin Haberkorn <rhaberkorn@fmsbw.de> | 2025-11-21 22:39:01 +0100 |
| commit | 4aaff7294131552be8c731e2f4d230106a1149f7 (patch) | |
| tree | 77db87ec5da219bf1e5bd0e6970e0901cedd319e | |
| parent | e06e7ab1ee41aeff9e29f43de47ac25eef474808 (diff) | |
fixed scrolling the command line after clicking in the popupHEADmaster-fmsbw-cimaster
We cannot rely on the central teco_cmdline_update() call per keypress
in this case.
The analogous call was removed in 4e6ddd6c329d56055a732c6344df019f0d997aaf,
so this was a recent regression.
| -rw-r--r-- | src/cmdline.c | 52 | ||||
| -rw-r--r-- | src/cmdline.h | 2 | ||||
| -rw-r--r-- | src/interface-curses/interface.c | 1 | ||||
| -rw-r--r-- | src/interface-gtk/interface.c | 1 |
4 files changed, 33 insertions, 23 deletions
diff --git a/src/cmdline.c b/src/cmdline.c index fc2a531..e1a4628 100644 --- a/src/cmdline.c +++ b/src/cmdline.c @@ -104,29 +104,6 @@ teco_cmdline_init(void) teco_cmdline_ssm(SCI_MARGINSETTEXT, 0, (sptr_t)"*"); } -static void -teco_cmdline_update(void) -{ - /* - * Update the command line indicators. - * FIXME: Perhaps this can be avoided completely by updating the - * indicators in teco_cmdline_insert(). - */ - gsize effective_len = teco_cmdline_ssm(SCI_GETCURRENTPOS, 0, 0); - gsize macro_len = teco_cmdline_ssm(SCI_GETLENGTH, 0, 0); - teco_cmdline_ssm(SCI_SETINDICATORCURRENT, INDICATOR_RUBBEDOUT, 0); - teco_cmdline_ssm(SCI_INDICATORCLEARRANGE, 0, macro_len); - teco_cmdline_ssm(SCI_INDICATORFILLRANGE, effective_len, macro_len - effective_len); - teco_cmdline_ssm(SCI_SCROLLCARET, 0, 0); - - /* - * FIXME: This gets reset repeatedly. - * Setting it once per keypress however means you can no longer customize - * the margin text. - */ - teco_cmdline_ssm(SCI_MARGINSETTEXT, 0, (sptr_t)"*"); -} - /** * Insert string into command line and execute * it immediately. @@ -480,6 +457,35 @@ teco_cmdline_rubout(void) } } +/** + * Update the command line, i.e. prepare it for displaying. + * + * This updates the indicators and scrolls the caret, which isn't done every time + * we touch the command line itself. + */ +void +teco_cmdline_update(void) +{ + /* + * FIXME: Perhaps this can be avoided completely by updating the + * indicators in teco_cmdline_insert(). + */ + gsize effective_len = teco_cmdline_ssm(SCI_GETCURRENTPOS, 0, 0); + gsize macro_len = teco_cmdline_ssm(SCI_GETLENGTH, 0, 0); + teco_cmdline_ssm(SCI_SETINDICATORCURRENT, INDICATOR_RUBBEDOUT, 0); + teco_cmdline_ssm(SCI_INDICATORCLEARRANGE, 0, macro_len); + teco_cmdline_ssm(SCI_INDICATORFILLRANGE, effective_len, macro_len - effective_len); + + teco_cmdline_ssm(SCI_SCROLLCARET, 0, 0); + + /* + * FIXME: This gets reset repeatedly. + * Setting it once per keypress however means you can no longer customize + * the margin text. + */ + teco_cmdline_ssm(SCI_MARGINSETTEXT, 0, (sptr_t)"*"); +} + void teco_cmdline_cleanup(void) { diff --git a/src/cmdline.h b/src/cmdline.h index bd3158d..9123358 100644 --- a/src/cmdline.h +++ b/src/cmdline.h @@ -112,6 +112,8 @@ teco_cmdline_keymacro_c(gchar key, GError **error) return TRUE; } +void teco_cmdline_update(void); + void teco_cmdline_cleanup(void); /* diff --git a/src/interface-curses/interface.c b/src/interface-curses/interface.c index a57b19c..8f41f2a 100644 --- a/src/interface-curses/interface.c +++ b/src/interface-curses/interface.c @@ -1870,6 +1870,7 @@ teco_interface_process_mevent(MEVENT *event, GError **error) teco_interface_popup_clear(); teco_interface_msg_clear(); + teco_cmdline_update(); } return TRUE; diff --git a/src/interface-gtk/interface.c b/src/interface-gtk/interface.c index 98c7266..7aa9797 100644 --- a/src/interface-gtk/interface.c +++ b/src/interface-gtk/interface.c @@ -1466,6 +1466,7 @@ teco_interface_popup_clicked_cb(GtkWidget *popup, gchar *str, gulong len, gpoint !machine->current->insert_completion_cb(machine, &insert, NULL)) return; teco_interface_popup_clear(); + teco_cmdline_update(); teco_interface_update(teco_interface_current_view != last_view); } |
