From 076af653df96bcd37a2615b455795b4e74a6d108 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Wed, 25 Mar 2026 07:49:36 -0400 Subject: Fix shift/ctrl insert mess. --- src/edbox.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/edbox.c b/src/edbox.c index 5f4371b..cfaa2d6 100644 --- a/src/edbox.c +++ b/src/edbox.c @@ -55,6 +55,10 @@ void edbox_hide(void) { scr_refresh(); } +void move_right(void) { + memmove(edit_box + edbox_pos + 1, edit_box + edbox_pos, EDBOX_SIZE - edbox_pos - 1); +} + /* note: c will never be an EOL. idea: when the edbox is completely full (240 chars), go ahead and pretend the user pressed Return (call edbox_callback, @@ -65,7 +69,7 @@ void edbox_putc(char c) { return; /* no inserting nulls */ if(!typeover) - memmove(edit_box + edbox_pos + 1, edit_box + edbox_pos, EDBOX_SIZE - edbox_pos - 1); + move_right(); edit_box[edbox_pos] = c; if(edbox_pos < EDBOX_SIZE - 1) { @@ -234,6 +238,13 @@ void edbox_keystroke(char c) { edbox_clear(); break; case XCH_INSCHR: + if(edbox_len < EDBOX_SIZE - 1) { + move_right(); + edbox_len++; + edit_box[edbox_pos] = ' '; + } + break; + case CH_INSLINE: typeover = !typeover; break; case 0x15: /* ^U */ -- cgit v1.2.3