aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/cmdline.c
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2024-08-28 20:52:03 +0200
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2024-09-09 18:17:03 +0200
commitc71ed30cf0c554d288edfe87842082cc9ec393a7 (patch)
tree8ae23bf7786793ad3450942f96055ff853d448ac /src/cmdline.c
parentf79a6f65acde9753ea65887e0e0d4bc7f76ff52b (diff)
downloadsciteco-c71ed30cf0c554d288edfe87842082cc9ec393a7.tar.gz
implemented Unicode support for rubin/rubout and a number of commands (WIP) (refs #5)
certain test cases are still way too slow: 10000<@I/X^J/> 20000<R> or 10000<@I/X^J/> 20000<%a-1J> SCI_ALLOCATELINECHARACTERINDEX does not help much here. It probably speeds up only SCI_LINEFROMINDEXPOSITION and SCI_INDEXPOSITIONFROMLINE.
Diffstat (limited to 'src/cmdline.c')
-rw-r--r--src/cmdline.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/cmdline.c b/src/cmdline.c
index ca0a570..255ffac 100644
--- a/src/cmdline.c
+++ b/src/cmdline.c
@@ -180,6 +180,19 @@ teco_cmdline_insert(const gchar *data, gsize len, GError **error)
}
gboolean
+teco_cmdline_rubin(GError **error)
+{
+ if (!teco_cmdline.str.len)
+ return TRUE;
+
+ const gchar *start, *end, *next;
+ start = teco_cmdline.str.data+teco_cmdline.effective_len;
+ end = teco_cmdline.str.data+teco_cmdline.str.len;
+ next = g_utf8_find_next_char(start, end) ? : end;
+ return teco_cmdline_insert(start, next-start, error);
+}
+
+gboolean
teco_cmdline_keypress_c(gchar key, GError **error)
{
teco_machine_t *machine = &teco_cmdline.machine.parent;
@@ -316,6 +329,18 @@ teco_cmdline_fnmacro(const gchar *name, GError **error)
return TRUE;
}
+void
+teco_cmdline_rubout(void)
+{
+ const gchar *p;
+ p = g_utf8_find_prev_char(teco_cmdline.str.data,
+ teco_cmdline.str.data+teco_cmdline.effective_len);
+ if (p) {
+ teco_cmdline.effective_len = p - teco_cmdline.str.data;
+ teco_undo_pop(teco_cmdline.effective_len);
+ }
+}
+
static void TECO_DEBUG_CLEANUP
teco_cmdline_cleanup(void)
{