diff --git a/system/termcurses/Kconfig b/system/termcurses/Kconfig index 47732e160..8d67591e8 100644 --- a/system/termcurses/Kconfig +++ b/system/termcurses/Kconfig @@ -12,6 +12,8 @@ config SYSTEM_TERMCURSES Terminal emulation library for curses support on TTY type consoles such as serial port, CDCACM, telnet, etc. + Must deselect CONFIG_DISABLE_POLL! + config SYSTEM_TERMCURSES_VT100 bool "Terminal pdcurses support for VT-100" depends on SYSTEM_TERMCURSES diff --git a/system/termcurses/tcurses_vt100.c b/system/termcurses/tcurses_vt100.c index b66f1a440..f77503c7c 100644 --- a/system/termcurses/tcurses_vt100.c +++ b/system/termcurses/tcurses_vt100.c @@ -1041,6 +1041,13 @@ static int tcurses_vt100_getkeycode(FAR struct termcurses_s *dev, FAR int *speci /* Update keycount and keybuf */ priv->keycount -= x; + if (priv->keycount < 0) + { + /* Hmm, some bug. Better to simply ignore than to crash */ + + priv->keycount = 0; + } + if (priv->keycount != 0) { memmove(priv->keybuf, &priv->keybuf[x], priv->keycount);