ANSI Escape Sequence ESC[nD Not Moving Cursor to the Left (32656)
The information in this article applies to:
- Microsoft MS-DOS operating system 3.1
- Microsoft MS-DOS operating system 3.2
- Microsoft MS-DOS operating system 3.21
- Microsoft MS-DOS operating system 3.3
- Microsoft MS-DOS operating system 3.3a
- Microsoft MS-DOS operating system 4.0
- Microsoft MS-DOS operating system 4.01
- Microsoft MS-DOS operating system 5.0
- Microsoft MS-DOS operating system 5.0a
- Microsoft MS-DOS operating system 6.0
- Microsoft MS-DOS operating system 6.2
- Microsoft MS-DOS operating system 6.21
- Microsoft MS-DOS operating system 6.22
This article was previously published under Q32656 SYMPTOMS
The ANSI escape sequence for Cursor Left doesn't function correctly. When
you type PROMPT $e[2D ], the cursor moves
all the way to the left-most column rather than moving back just two
columns.
CAUSE
This behavior is by design. Each time you issue a PROMPT command, a
carriage return/linefeed sequence is sent. So each time a PROMPT command is
issued, the cursor is moved to column 1. If you then try to move two
columns to the left, you are unable to do so because you are already at the
farthest left column; the "ESC[nD" escape sequence has no effect if the
cursor is in the farthest left column.
WORKAROUND
To avoid this situation, move the cursor in a batch file. For example, to
move the cursor two columns to the left you would use the following escape
sequence:
echo ESC[2D
Modification Type: | Major | Last Reviewed: | 5/12/2003 |
---|
Keywords: | KB32656 |
---|
|