You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ac...@apache.org on 2024/10/28 13:10:20 UTC
(nuttx-apps) 01/02: termcurses: Disable ICANON for serial driver. That was broken VI editor.
This is an automated email from the ASF dual-hosted git repository.
acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git
commit c0e04b02514aa5986c298fdaf865bffc1eb74d34
Author: Leo Chung <ge...@gmail.com>
AuthorDate: Thu Oct 24 16:58:55 2024 +0800
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 <ge...@gmail.com>
---
system/termcurses/tcurses_vt100.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/system/termcurses/tcurses_vt100.c b/system/termcurses/tcurses_vt100.c
index 33fcc3be3..2cd3c215a 100644
--- a/system/termcurses/tcurses_vt100.c
+++ b/system/termcurses/tcurses_vt100.c
@@ -1500,11 +1500,11 @@ FAR struct termcurses_s *tcurses_vt100_initialize(int in_fd, int out_fd)
priv->lflag = cfg.c_lflag;
- /* If ECHO enabled, disable it */
+ /* If ECHO and ICANON enabled, disable it */
- if (cfg.c_lflag & ECHO)
+ if (cfg.c_lflag & (ECHO | ICANON))
{
- cfg.c_lflag &= ~ECHO;
+ cfg.c_lflag &= ~(ECHO | ICANON);
tcsetattr(priv->in_fd, TCSANOW, &cfg);
}
}
@@ -1546,9 +1546,10 @@ static int tcurses_vt100_terminate(FAR struct termcurses_s *dev)
if (isatty(priv->in_fd))
{
- if (tcgetattr(priv->in_fd, &cfg) == 0 && priv->lflag & ECHO)
+ if ((priv->lflag & (ECHO | ICANON))
+ && tcgetattr(priv->in_fd, &cfg) == 0)
{
- cfg.c_lflag |= ECHO;
+ cfg.c_lflag = priv->lflag;
tcsetattr(priv->in_fd, TCSANOW, &cfg);
}
}