Kernel/Shell: Add support for delete key
This commit is contained in:
parent
4ca147699d
commit
d68ad893f0
|
@ -222,6 +222,9 @@ namespace Kernel
|
|||
case LibInput::Key::Escape:
|
||||
ansi_c_str = "\e";
|
||||
break;
|
||||
case LibInput::Key::Delete:
|
||||
ansi_c_str = "\x7F";
|
||||
break;
|
||||
case LibInput::Key::ArrowUp:
|
||||
ansi_c_str = "\e[A";
|
||||
break;
|
||||
|
|
|
@ -892,6 +892,16 @@ int main(int argc, char** argv)
|
|||
putchar('\n');
|
||||
clean_exit(0);
|
||||
break;
|
||||
case '\x7F': // delete
|
||||
if (col < buffers[index].size())
|
||||
{
|
||||
buffers[index].remove(col);
|
||||
while (col < buffers[index].size() && (buffers[index][col] & 0xC0) == 0x80)
|
||||
buffers[index].remove(col);
|
||||
printf("\e[s%s \e[u", buffers[index].data() + col);
|
||||
fflush(stdout);
|
||||
}
|
||||
break;
|
||||
case '\n':
|
||||
putchar('\n');
|
||||
if (!buffers[index].empty())
|
||||
|
|
Loading…
Reference in New Issue