summaryrefslogtreecommitdiff
path: root/nuttx/graphics/nxconsole/nxcon_putc.c
diff options
context:
space:
mode:
Diffstat (limited to 'nuttx/graphics/nxconsole/nxcon_putc.c')
-rw-r--r--nuttx/graphics/nxconsole/nxcon_putc.c63
1 files changed, 63 insertions, 0 deletions
diff --git a/nuttx/graphics/nxconsole/nxcon_putc.c b/nuttx/graphics/nxconsole/nxcon_putc.c
index 97e3314a6..d51d79c79 100644
--- a/nuttx/graphics/nxconsole/nxcon_putc.c
+++ b/nuttx/graphics/nxconsole/nxcon_putc.c
@@ -39,6 +39,8 @@
#include <nuttx/config.h>
+#include <nuttx/ascii.h>
+
#include "nxcon_internal.h"
/****************************************************************************
@@ -85,6 +87,14 @@ void nxcon_putc(FAR struct nxcon_state_s *priv, uint8_t ch)
return;
}
+ /* Handle backspace (treating both BS and DEL as backspace) */
+
+ if (ch == ASCII_BS || ch == ASCII_DEL)
+ {
+ nxcon_backspace(priv);
+ return;
+ }
+
/* Will another character fit on this line? */
if (priv->fpos.x + priv->fwidth > priv->wndo.wsize.w)
@@ -138,3 +148,56 @@ void nxcon_putc(FAR struct nxcon_state_s *priv, uint8_t ch)
nxcon_fillchar(priv, NULL, bm);
}
}
+
+/****************************************************************************
+ * Name: nxcon_showcursor
+ *
+ * Description:
+ * Render the cursor character at the current display position.
+ *
+ ****************************************************************************/
+
+void nxcon_showcursor(FAR struct nxcon_state_s *priv)
+{
+ int lineheight;
+
+ /* Will another character fit on this line? */
+
+ if (priv->fpos.x + priv->fwidth > priv->wndo.wsize.w)
+ {
+#ifndef CONFIG_NXCONSOLE_NOWRAP
+ /* No.. move to the next line */
+
+ nxcon_newline(priv);
+#else
+ return;
+#endif
+ }
+
+ /* Check if we need to scroll up */
+
+ lineheight = (priv->fheight + CONFIG_NXCONSOLE_LINESEPARATION);
+ while (priv->fpos.y >= priv->wndo.wsize.h - lineheight)
+ {
+ nxcon_scroll(priv, lineheight);
+ }
+
+ /* Render the cursor glyph onto the display. */
+
+ priv->cursor.pos.x = priv->fpos.x;
+ priv->cursor.pos.y = priv->fpos.y;
+ nxcon_fillchar(priv, NULL, &priv->cursor);
+}
+
+/****************************************************************************
+ * Name: nxcon_hidecursor
+ *
+ * Description:
+ * Render the cursor cursor character from the display.
+ *
+ ****************************************************************************/
+
+void nxcon_hidecursor(FAR struct nxcon_state_s *priv)
+{
+ (void)nxcon_hidechar(priv, &priv->cursor);
+}