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
+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':