summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2014-05-23 07:59:17 -0600
committerGregory Nutt <gnutt@nuttx.org>2014-05-23 07:59:17 -0600
commitb53ce36d904de78881763524a83822766e47c600 (patch)
tree91ae97beb8095547060de610de5e28ab7556d8d6 /apps
parentd5d3aa39f9476b2cbc2be0fffaf334b17a671720 (diff)
downloadnuttx-b53ce36d904de78881763524a83822766e47c600.tar.gz
nuttx-b53ce36d904de78881763524a83822766e47c600.tar.bz2
nuttx-b53ce36d904de78881763524a83822766e47c600.zip
CLE: Last bugfix commit was insufficient
Diffstat (limited to 'apps')
-rw-r--r--apps/system/cle/cle.c36
1 files changed, 11 insertions, 25 deletions
diff --git a/apps/system/cle/cle.c b/apps/system/cle/cle.c
index 2f1af2116..b8e5084ab 100644
--- a/apps/system/cle/cle.c
+++ b/apps/system/cle/cle.c
@@ -824,45 +824,31 @@ static int cle_editloop(FAR struct cle_s *priv)
}
break;
- /* Newline terminates editing */
+ /* Newline terminates editing. But what is a newline? */
-#if defined(CONFIG_EOL_IS_CR)
+#if defined(CONFIG_EOL_IS_CR) || defined(CONFIG_EOL_IS_EITHER_CRLF)
case '\r': /* CR terminates line */
- {
- /* Add the newline character to the buffer */
- cle_insertch(priv, '\n');
- return OK;
- }
- break;
-
-#elif defined(CONFIG_EOL_IS_BOTH_CRLF)
- case '\r': /* Wait for the LF */
- break;
-#endif
+#elif defined(CONFIG_EOL_IS_LF) || defined(CONFIG_EOL_IS_BOTH_CRLF) || \
+ defined(CONFIG_EOL_IS_EITHER_CRLF)
-#if defined(CONFIG_EOL_IS_LF) || defined(CONFIG_EOL_IS_BOTH_CRLF)
case '\n': /* LF terminates line */
+#endif
{
- /* Add the newline character to the buffer */
+ /* Add the newline character to the buffer at the end of the line */
+ priv->curpos = priv->nchars;
cle_insertch(priv, '\n');
+ cle_putch(priv, '\n');
return OK;
}
break;
-#endif
-
-#ifdef CONFIG_EOL_IS_EITHER_CRLF
- case '\r': /* Either CR or LF terminates line */
- case '\n':
- {
- /* Add the newline character to the buffer */
- cle_insertch(priv, '\n');
- return OK;
- }
+#if defined(CONFIG_EOL_IS_BOTH_CRLF)
+ case '\r': /* Wait for the LF */
break;
#endif
+
/* Text to insert or unimplemented/invalid keypresses */
default: