diff options
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 */ |
