Skip to content

Commit c0e04b0

Browse files
bl4kravenacassis
authored andcommitted
termcurses: Disable ICANON for serial driver. That was broken VI editor.
The ICANON flag broken VI key input, so disable it. Signed-off-by: Leo Chung <gewalalb@gmail.com>
1 parent 41bc4f7 commit c0e04b0

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

system/termcurses/tcurses_vt100.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1500,11 +1500,11 @@ FAR struct termcurses_s *tcurses_vt100_initialize(int in_fd, int out_fd)
15001500

15011501
priv->lflag = cfg.c_lflag;
15021502

1503-
/* If ECHO enabled, disable it */
1503+
/* If ECHO and ICANON enabled, disable it */
15041504

1505-
if (cfg.c_lflag & ECHO)
1505+
if (cfg.c_lflag & (ECHO | ICANON))
15061506
{
1507-
cfg.c_lflag &= ~ECHO;
1507+
cfg.c_lflag &= ~(ECHO | ICANON);
15081508
tcsetattr(priv->in_fd, TCSANOW, &cfg);
15091509
}
15101510
}
@@ -1546,9 +1546,10 @@ static int tcurses_vt100_terminate(FAR struct termcurses_s *dev)
15461546

15471547
if (isatty(priv->in_fd))
15481548
{
1549-
if (tcgetattr(priv->in_fd, &cfg) == 0 && priv->lflag & ECHO)
1549+
if ((priv->lflag & (ECHO | ICANON))
1550+
&& tcgetattr(priv->in_fd, &cfg) == 0)
15501551
{
1551-
cfg.c_lflag |= ECHO;
1552+
cfg.c_lflag = priv->lflag;
15521553
tcsetattr(priv->in_fd, TCSANOW, &cfg);
15531554
}
15541555
}

0 commit comments

Comments
 (0)