aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/cmdline.c
diff options
context:
space:
mode:
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)
{