forked from Bananymous/banan-os
Kernel: Make backspace \b and delete 0x7F
This is what `vim` seems to expect and imo makes way more sense.
This commit is contained in:
@@ -210,6 +210,8 @@ namespace Kernel
|
||||
void SerialTTY::handle_irq()
|
||||
{
|
||||
uint8_t ch = IO::inb(m_serial.port());
|
||||
if (ch == 0x7F)
|
||||
ch = '\b';
|
||||
|
||||
SpinLockGuard _(m_input_lock);
|
||||
if (m_input.full())
|
||||
|
||||
@@ -285,14 +285,6 @@ namespace Kernel
|
||||
|
||||
void TTY::do_backspace()
|
||||
{
|
||||
auto print_backspace =
|
||||
[this]
|
||||
{
|
||||
putchar('\b');
|
||||
putchar(' ');
|
||||
putchar('\b');
|
||||
};
|
||||
|
||||
if (m_output.bytes > 0)
|
||||
{
|
||||
uint8_t last = m_output.buffer[m_output.bytes - 1];
|
||||
@@ -308,20 +300,20 @@ namespace Kernel
|
||||
}
|
||||
ASSERT(m_output.bytes > 0);
|
||||
m_output.bytes--;
|
||||
print_backspace();
|
||||
putchar('\b');
|
||||
}
|
||||
// Caret notation
|
||||
else if (last < 32 || last == 127)
|
||||
{
|
||||
m_output.bytes--;
|
||||
print_backspace();
|
||||
print_backspace();
|
||||
putchar('\b');
|
||||
putchar('\b');
|
||||
}
|
||||
// Ascii
|
||||
else
|
||||
{
|
||||
m_output.bytes--;
|
||||
print_backspace();
|
||||
putchar('\b');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -461,7 +461,7 @@ namespace Kernel
|
||||
break;
|
||||
case BS:
|
||||
if (m_column > 0)
|
||||
m_column--;
|
||||
putchar_at(' ', --m_column, m_row);
|
||||
break;
|
||||
case HT:
|
||||
m_column++;
|
||||
@@ -480,7 +480,7 @@ namespace Kernel
|
||||
break;
|
||||
case ESC:
|
||||
m_state = State::WaitingAnsiEscape;
|
||||
break;;
|
||||
break;
|
||||
default:
|
||||
putchar_at(codepoint, m_column, m_row);
|
||||
m_last_graphic_char = codepoint;
|
||||
|
||||
Reference in New Issue
Block a user