浏览代码

[console] Allow '?' as an intermediate byte in ANSI escape sequences

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>
tags/v1.20.1
Michael Brown 11 年前
父节点
当前提交
135bf35b11
共有 2 个文件被更改,包括 8 次插入1 次删除
  1. 2
    1
      src/core/ansiesc.c
  2. 6
    0
      src/include/ipxe/ansiesc.h

+ 2
- 1
src/core/ansiesc.c 查看文件

@@ -99,7 +99,8 @@ int ansiesc_process ( struct ansiesc_context *ctx, int c ) {
99 99
 				DBG ( "Too many parameters in ANSI escape "
100 100
 				      "sequence\n" );
101 101
 			}
102
-		} else if ( ( c >= 0x20 ) && ( c <= 0x2f ) ) {
102
+		} else if ( ( ( c >= 0x20 ) && ( c <= 0x2f ) ) ||
103
+			    ( c == '?' ) ) {
103 104
 			/* Intermediate Byte */
104 105
 			ctx->function <<= 8;
105 106
 			ctx->function |= c;

+ 6
- 0
src/include/ipxe/ansiesc.h 查看文件

@@ -124,6 +124,12 @@ struct ansiesc_context {
124 124
  */
125 125
 #define ANSIESC_LOG_PRIORITY 'p'
126 126
 
127
+/** Show cursor */
128
+#define ANSIESC_DECTCEM_SET ( ( '?' << 8 ) | 'h' )
129
+
130
+/** Hide cursor */
131
+#define ANSIESC_DECTCEM_RESET ( ( '?' << 8 ) | 'l' )
132
+
127 133
 /** @} */
128 134
 
129 135
 extern int ansiesc_process ( struct ansiesc_context *ctx, int c );

正在加载...
取消
保存