aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/cmdline.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmdline.c')
-rw-r--r--src/cmdline.c52
1 files changed, 29 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)
{