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:
|
case LibInput::Key::Escape:
|
||||||
ansi_c_str = "\e";
|
ansi_c_str = "\e";
|
||||||
break;
|
break;
|
||||||
|
case LibInput::Key::Delete:
|
||||||
|
ansi_c_str = "\x7F";
|
||||||
|
break;
|
||||||
case LibInput::Key::ArrowUp:
|
case LibInput::Key::ArrowUp:
|
||||||
ansi_c_str = "\e[A";
|
ansi_c_str = "\e[A";
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -892,6 +892,16 @@ int main(int argc, char** argv)
|
||||||
putchar('\n');
|
putchar('\n');
|
||||||
clean_exit(0);
|
clean_exit(0);
|
||||||
break;
|
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':
|
case '\n':
|
||||||
putchar('\n');
|
putchar('\n');
|
||||||
if (!buffers[index].empty())
|
if (!buffers[index].empty())
|
||||||
|
|
Loading…
Reference in New Issue