Skip to content

Commit

Permalink
readline: Support delete key
Browse files Browse the repository at this point in the history
  • Loading branch information
mintsuki committed Oct 30, 2020
1 parent 562bdf7 commit dd5c8b4
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 0 deletions.
Binary file modified limine.bin
Binary file not shown.
2 changes: 2 additions & 0 deletions stage2/lib/blib.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ int getchar_internal(uint32_t eax) {
return GETCHAR_CURSOR_UP;
case 0x50:
return GETCHAR_CURSOR_DOWN;
case 0x53:
return GETCHAR_DELETE;
}
return (char)(eax & 0xff);
}
Expand Down
1 change: 1 addition & 0 deletions stage2/lib/blib.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ int pit_sleep_and_quit_on_keypress(uint32_t pit_ticks);
#define GETCHAR_CURSOR_RIGHT (-11)
#define GETCHAR_CURSOR_UP (-12)
#define GETCHAR_CURSOR_DOWN (-13)
#define GETCHAR_DELETE (-14)

int getchar(void);
uint64_t strtoui(const char *s);
Expand Down
1 change: 1 addition & 0 deletions stage2/lib/readline.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ void readline(const char *orig_str, char *buf, size_t limit) {
if (i) {
i--;
cursor_back();
case GETCHAR_DELETE:;
size_t j;
for (j = i; ; j++) {
buf[j] = buf[j+1];
Expand Down

0 comments on commit dd5c8b4

Please sign in to comment.