Replace \b with \0177 as erase character

This commit is contained in:
Mark
2020-07-23 17:51:13 +03:00
parent 461effbfd1
commit 1314eafb3d
4 changed files with 9 additions and 8 deletions
+2 -2
View File
@@ -48,7 +48,7 @@ static const char ps2_key_table_0[128] = {
[0x00] = 0,
[0x01] = '\033',
[0x02] = '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=', '\b',
[0x02] = '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=', 0x7F,
[0x0F] = '\t',
[0x10] = 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', '[', ']',
[0x1C] = '\n',
@@ -64,7 +64,7 @@ static const char ps2_key_table_1[128] = {
[0x00] = 0,
[0x01] = '\033',
[0x02] = '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+', '\b',
[0x02] = '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+', 0x7F,
[0x0F] = '\t',
[0x10] = 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', '{', '}',
[0x1C] = '\n',
+1 -1
View File
@@ -55,7 +55,7 @@ void input_key(uint8_t key, uint8_t mods, const char *map0, const char *map1) {
const char *map = (mods & INPUT_MOD_SHIFT) ? map1 : map0;
uint8_t c = map[key];
if (c && c < 0x7F) {
if (c && c <= 0x7F) {
if (mods & INPUT_MOD_CAPS) {
if (islower(c)) {
c = toupper(c);
+5 -4
View File
@@ -46,18 +46,19 @@ ssize_t line_read(struct chrdev *chr, void *buf, size_t pos, size_t lim) {
}
}
if (c == '\b') {
if (rd) {
if (c == 0x7F) {
if (chr->tc.c_iflag & ICANON) {
if (chr->tc.c_lflag & ECHOE) {
tty_puts(chr, "\033[D \033[D");
}
if (chr->tc.c_iflag & ICANON) {
if (rd) {
--wr;
++rem;
--rd;
continue;
}
continue;
}
}
+1 -1
View File
@@ -68,7 +68,7 @@ void tty_data_write(struct chrdev *tty, char c) {
ring_signal(&tty->buffer, RING_SIGNAL_RET);
}
break;
case '\b':
case 0x7F:
ring_signal(&tty->buffer, 0);
break;
case '\033':