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. --- TODO | 4 ---- src/edbox.c | 13 ++++++++++++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/TODO b/TODO index c9c687f..425f0a4 100644 --- a/TODO +++ b/TODO @@ -19,10 +19,6 @@ Other stuff: - [*] BUG: after start+number, start+a, start+tab, the first keystroke gets ignored. Does not happen with esc or ctrl-numbers. -- [*] BUG: ctrl-insert is supposed to insert a space manually, and - shift-insert is supposed to toggle insert/overwrite modes. Instead - ctrl-insert is inserting a space and shift-insert is adding the - raw ATASCII character to the buffer (inverse down arrowe). - [*] Start+A should *always* switch windows, even if all are inactive. It can act like Start+Left in that case. - [*] Auto-pinging the server seems to work, but needs more testing. 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