Skip to content

Commit

Permalink
[console] Allow '?' as an intermediate byte in ANSI escape sequences
Browse files Browse the repository at this point in the history
The ANSI escape sequences to show and hide the cursor take the form
"<ESC>[?25h" and "<ESC>[?25l" respectively.  iPXE currently treats the
'?' character as the final byte.  Fix by explicitly treating '?' as an
intermediate byte.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
  • Loading branch information
mcb30 committed Dec 2, 2013
1 parent 1403bda commit 135bf35
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/core/ansiesc.c
Expand Up @@ -99,7 +99,8 @@ int ansiesc_process ( struct ansiesc_context *ctx, int c ) {
DBG ( "Too many parameters in ANSI escape "
"sequence\n" );
}
} else if ( ( c >= 0x20 ) && ( c <= 0x2f ) ) {
} else if ( ( ( c >= 0x20 ) && ( c <= 0x2f ) ) ||
( c == '?' ) ) {
/* Intermediate Byte */
ctx->function <<= 8;
ctx->function |= c;
Expand Down
6 changes: 6 additions & 0 deletions src/include/ipxe/ansiesc.h
Expand Up @@ -124,6 +124,12 @@ struct ansiesc_context {
*/
#define ANSIESC_LOG_PRIORITY 'p'

/** Show cursor */
#define ANSIESC_DECTCEM_SET ( ( '?' << 8 ) | 'h' )

/** Hide cursor */
#define ANSIESC_DECTCEM_RESET ( ( '?' << 8 ) | 'l' )

/** @} */

extern int ansiesc_process ( struct ansiesc_context *ctx, int c );
Expand Down

0 comments on commit 135bf35

Please sign in to comment.