diff options
| author | B. Watson <urchlay@slackware.uk> | 2026-03-25 07:49:36 -0400 |
|---|---|---|
| committer | B. Watson <urchlay@slackware.uk> | 2026-03-25 07:49:36 -0400 |
| commit | 076af653df96bcd37a2615b455795b4e74a6d108 (patch) | |
| tree | 51e8aec2c44413e9520d03bd46a422aef14ca64d /src/edbox.c | |
| parent | 3419fe7ccd1bce33e3ecd688b49c75da72da01d2 (diff) | |
| download | fujinet-chat-076af653df96bcd37a2615b455795b4e74a6d108.tar.gz | |
Fix shift/ctrl insert mess.
Diffstat (limited to 'src/edbox.c')
| -rw-r--r-- | src/edbox.c | 13 |
1 files changed, 12 insertions, 1 deletions
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 */ |
