readline: Support delete key

This commit is contained in:
mintsuki 2020-10-27 08:38:43 +01:00
parent 530b4a8f3b
commit 1de574944a
4 changed files with 4 additions and 0 deletions

Binary file not shown.

View File

@ -197,6 +197,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);
}

View File

@ -31,6 +31,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);

View File

@ -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];