aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2026-03-25 07:49:36 -0400
committerB. Watson <urchlay@slackware.uk>2026-03-25 07:49:36 -0400
commit076af653df96bcd37a2615b455795b4e74a6d108 (patch)
tree51e8aec2c44413e9520d03bd46a422aef14ca64d
parent3419fe7ccd1bce33e3ecd688b49c75da72da01d2 (diff)
downloadfujinet-chat-076af653df96bcd37a2615b455795b4e74a6d108.tar.gz
Fix shift/ctrl insert mess.
-rw-r--r--TODO4
-rw-r--r--src/edbox.c13
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 */