Kernel: Enable ECHOE and ECHOK, support VKILL, fix VEOF

This commit is contained in:
Bananymous 2025-06-02 16:26:53 +03:00
parent 775c77c0fa
commit 4c0b7d44b4
4 changed files with 10 additions and 7 deletions

View File

@ -162,7 +162,7 @@ namespace Kernel
.c_iflag = 0,
.c_oflag = 0,
.c_cflag = CS8,
.c_lflag = ECHO | ICANON | ISIG,
.c_lflag = ECHO | ECHOE | ECHOK | ICANON | ISIG,
.c_cc = TTY_DEFAULT_TERMIOS_CC,
.c_ospeed = B38400,
.c_ispeed = B38400,

View File

@ -174,7 +174,7 @@ namespace Kernel
.c_iflag = ICRNL,
.c_oflag = OPOST | ONLCR,
.c_cflag = CS8,
.c_lflag = ECHO | ICANON | ISIG,
.c_lflag = ECHO | ECHOE | ECHOK | ICANON | ISIG,
.c_cc = TTY_DEFAULT_TERMIOS_CC,
.c_ospeed = B38400,
.c_ispeed = B38400,

View File

@ -266,8 +266,12 @@ namespace Kernel
if (ch == m_termios.c_cc[VERASE] && (m_termios.c_lflag & ECHOE))
return do_backspace();
//if (ch == m_termios.c_cc[VKILL] && (m_termios.c_lflag & ECHOK))
// ;
if (ch == m_termios.c_cc[VKILL] && (m_termios.c_lflag & ECHOK))
{
while (m_output.bytes > 0 && m_output.buffer[m_output.bytes - 1] != '\n')
do_backspace();
return;
}
if (ch == m_termios.c_cc[VEOF])
{
@ -277,7 +281,6 @@ namespace Kernel
if (ch == NL || ch == m_termios.c_cc[VEOL])
{
should_append = true;
should_flush = true;
force_echo = !!(m_termios.c_lflag & ECHONL);
ch = NL;
@ -297,7 +300,7 @@ namespace Kernel
m_output.buffer[m_output.bytes++] = ch;
}
if (force_echo || (m_termios.c_lflag & ECHO))
if (should_append && (force_echo || (m_termios.c_lflag & ECHO)))
{
if ((ch <= 31 || ch == 127) && ch != '\n')
{

View File

@ -40,7 +40,7 @@ namespace Kernel
.c_iflag = 0,
.c_oflag = 0,
.c_cflag = CS8,
.c_lflag = ECHO | ICANON | ISIG,
.c_lflag = ECHO | ECHOE | ECHOK | ICANON | ISIG,
.c_cc = TTY_DEFAULT_TERMIOS_CC,
.c_ospeed = B38400,
.c_ispeed = B38400,