mirror of
https://github.com/apache/nuttx.git
synced 2026-05-31 14:27:37 +08:00
Add a test for the NX console device
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4528 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
@@ -138,21 +138,37 @@ static ssize_t nxcon_write(FAR struct file *filep, FAR const char *buffer,
|
|||||||
|
|
||||||
while (buflen-- > 0)
|
while (buflen-- > 0)
|
||||||
{
|
{
|
||||||
|
/* Ignore carriage returns */
|
||||||
|
|
||||||
|
ch = *buffer++;
|
||||||
|
if (ch == '\r')
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
/* Will another character fit on this line? */
|
/* Will another character fit on this line? */
|
||||||
|
|
||||||
if (priv->fpos.x + priv->fwidth > priv->wndo.wsize.w)
|
if (priv->fpos.x + priv->fwidth > priv->wndo.wsize.w)
|
||||||
{
|
{
|
||||||
|
#ifndef CONFIG_NXCONSOLE_NOWRAP
|
||||||
/* No.. move to the next line */
|
/* No.. move to the next line */
|
||||||
|
|
||||||
nxcon_newline(priv);
|
nxcon_newline(priv);
|
||||||
|
|
||||||
/* If we were about to output a newline character, then don't */
|
/* If we were about to output a newline character, then don't */
|
||||||
|
|
||||||
if (*buffer == '\n')
|
if (ch == '\n')
|
||||||
{
|
{
|
||||||
buffer++;
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
/* No.. Ignore all further characters until a newline is encountered */
|
||||||
|
|
||||||
|
if (ch != '\n')
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if we need to scroll up (handling a corner case where
|
/* Check if we need to scroll up (handling a corner case where
|
||||||
@@ -164,16 +180,10 @@ static ssize_t nxcon_write(FAR struct file *filep, FAR const char *buffer,
|
|||||||
nxcon_scroll(priv, lineheight);
|
nxcon_scroll(priv, lineheight);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ignore carriage returns */
|
|
||||||
|
|
||||||
ch = *buffer++;
|
|
||||||
if (ch != '\r')
|
|
||||||
{
|
|
||||||
/* Finally, we can output the character */
|
/* Finally, we can output the character */
|
||||||
|
|
||||||
nxcon_putc(priv, (uint8_t)ch);
|
nxcon_putc(priv, (uint8_t)ch);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return buflen;
|
return buflen;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -171,6 +171,28 @@ EXTERN NXCONSOLE nxtool_register(NXTKWINDOW hfwnd,
|
|||||||
|
|
||||||
EXTERN void nxcon_unregister(NXCONSOLE handle);
|
EXTERN void nxcon_unregister(NXCONSOLE handle);
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: nxcon_redraw
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Re-draw a portion of the NX console. This function should be called
|
||||||
|
* from the appropriate window callback logic.
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* handle - A handle previously returned by nx_register, nxtk_register, or
|
||||||
|
* nxtool_register.
|
||||||
|
* rect - The rectangle that needs to be re-drawn (in window relative
|
||||||
|
* coordinates)
|
||||||
|
* more - true: More re-draw requests will follow
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
EXTERN void nxcon_redraw(NXCONSOLE handle, FAR const struct nxgl_rect_s *rect,
|
||||||
|
bool more);
|
||||||
|
|
||||||
#undef EXTERN
|
#undef EXTERN
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user