Skip to main content
added 3 characters in body
Source Link
slm
  • 379.8k
  • 127
  • 793
  • 897

NOTE: This is as I understand things, so it might be a bit off!

The characters ^[ typically signifies the Escape key itself. That's a Control (^) + a open square bracket ([).

excerpt from Escape characters - ASCII escape character

The ASCII "escape" character (octal: \033, hexadecimal: \x1B, or ^[, or, in decimal, 27) is used in many output devices to start a series of characters called a control sequence or escape sequence. Typically, the escape character was sent first in such a sequence to alert the device that the following characters were to be interpreted as a control sequence rather than as plain characters, then one or more characters would follow to specify some detailed action, after which the device would go back to interpreting characters normally. For example, the sequence of ^[, followed by the printable characters [2;10H, would cause a DEC VT102 terminal to move its cursor to the 10th cell of the 2nd line of the screen. This was later developed to ANSI escape codes covered by the ANSI X3.64 standard. The escape character also starts each command sequence in the Hewlett Packard Printer Command Language.

On systems where you're using UTF-8 this escape sequence is actually 2 characters, so it's now ^[ followed by an additional [.

excerpt from ANSI escape code - Sequence Elements

There is a single-character CSI (155/0x9B/0233) as well. The ESC+[ two-character sequence is more often used than the single-character alternative, for details see C0 and C1 control codes. Only the two-character sequence is recognized by devices that support just ASCII (7-bit bytes) or devices that support 8-bit bytes but use the 0x80–0x9F control character range for other purposes. On terminals that use UTF-8 encoding, both forms take 2 bytes (CSI in UTF-8 is 0xC2, 0x9B)[discuss] but the ESC+[ sequence is clearer.

Knowing the above 2 pieces of information this would make your escape sequence Esc+[+D which works out to be, big surprise, the backspace character.

excerpt -from ANSI Escape sequences

Esc[ValueD     Cursor Backward: Moves the cursor back by the specified 
               number of columns without changing lines. If the cursor is 
               already in the leftmost column, ANSI.SYS ignores this 
               sequence.

References

NOTE: This is as I understand things, so it might be a bit off!

The characters ^[ typically signifies the Escape key itself. That's a Control (^) + a open square bracket ([).

excerpt from Escape characters - ASCII escape character

The ASCII "escape" character (octal: \033, hexadecimal: \x1B, or ^[, or, in decimal, 27) is used in many output devices to start a series of characters called a control sequence or escape sequence. Typically, the escape character was sent first in such a sequence to alert the device that the following characters were to be interpreted as a control sequence rather than as plain characters, then one or more characters would follow to specify some detailed action, after which the device would go back to interpreting characters normally. For example, the sequence of ^[, followed by the printable characters [2;10H, would cause a DEC VT102 terminal to move its cursor to the 10th cell of the 2nd line of the screen. This was later developed to ANSI escape codes covered by the ANSI X3.64 standard. The escape character also starts each command sequence in the Hewlett Packard Printer Command Language.

On systems where you're using UTF-8 this escape sequence is actually 2 characters, so it's now ^[ followed by an additional [.

excerpt from ANSI escape code - Sequence Elements

There is a single-character CSI (155/0x9B/0233) as well. The ESC+[ two-character sequence is more often used than the single-character alternative, for details see C0 and C1 control codes. Only the two-character sequence is recognized by devices that support just ASCII (7-bit bytes) or devices that support 8-bit bytes but use the 0x80–0x9F control character range for other purposes. On terminals that use UTF-8 encoding, both forms take 2 bytes (CSI in UTF-8 is 0xC2, 0x9B)[discuss] but the ESC+[ sequence is clearer.

Knowing the above 2 pieces of information this would make your escape sequence Esc+[+D which works out to be, big surprise, the backspace character.

excerpt - ANSI Escape sequences

Esc[ValueD     Cursor Backward: Moves the cursor back by the specified 
               number of columns without changing lines. If the cursor is 
               already in the leftmost column, ANSI.SYS ignores this 
               sequence.

References

NOTE: This is as I understand things, so it might be a bit off!

The characters ^[ typically signifies the Escape key itself. That's a Control (^) + a open square bracket ([).

excerpt from Escape characters - ASCII escape character

The ASCII "escape" character (octal: \033, hexadecimal: \x1B, or ^[, or, in decimal, 27) is used in many output devices to start a series of characters called a control sequence or escape sequence. Typically, the escape character was sent first in such a sequence to alert the device that the following characters were to be interpreted as a control sequence rather than as plain characters, then one or more characters would follow to specify some detailed action, after which the device would go back to interpreting characters normally. For example, the sequence of ^[, followed by the printable characters [2;10H, would cause a DEC VT102 terminal to move its cursor to the 10th cell of the 2nd line of the screen. This was later developed to ANSI escape codes covered by the ANSI X3.64 standard. The escape character also starts each command sequence in the Hewlett Packard Printer Command Language.

On systems where you're using UTF-8 this escape sequence is actually 2 characters, so it's now ^[ followed by an additional [.

excerpt from ANSI escape code - Sequence Elements

There is a single-character CSI (155/0x9B/0233) as well. The ESC+[ two-character sequence is more often used than the single-character alternative, for details see C0 and C1 control codes. Only the two-character sequence is recognized by devices that support just ASCII (7-bit bytes) or devices that support 8-bit bytes but use the 0x80–0x9F control character range for other purposes. On terminals that use UTF-8 encoding, both forms take 2 bytes (CSI in UTF-8 is 0xC2, 0x9B)[discuss] but the ESC+[ sequence is clearer.

Knowing the above 2 pieces of information this would make your escape sequence Esc+[+D which works out to be, big surprise, the backspace character.

excerpt from ANSI Escape sequences

Esc[ValueD     Cursor Backward: Moves the cursor back by the specified 
               number of columns without changing lines. If the cursor is 
               already in the leftmost column, ANSI.SYS ignores this 
               sequence.

References

Source Link
slm
  • 379.8k
  • 127
  • 793
  • 897

NOTE: This is as I understand things, so it might be a bit off!

The characters ^[ typically signifies the Escape key itself. That's a Control (^) + a open square bracket ([).

excerpt from Escape characters - ASCII escape character

The ASCII "escape" character (octal: \033, hexadecimal: \x1B, or ^[, or, in decimal, 27) is used in many output devices to start a series of characters called a control sequence or escape sequence. Typically, the escape character was sent first in such a sequence to alert the device that the following characters were to be interpreted as a control sequence rather than as plain characters, then one or more characters would follow to specify some detailed action, after which the device would go back to interpreting characters normally. For example, the sequence of ^[, followed by the printable characters [2;10H, would cause a DEC VT102 terminal to move its cursor to the 10th cell of the 2nd line of the screen. This was later developed to ANSI escape codes covered by the ANSI X3.64 standard. The escape character also starts each command sequence in the Hewlett Packard Printer Command Language.

On systems where you're using UTF-8 this escape sequence is actually 2 characters, so it's now ^[ followed by an additional [.

excerpt from ANSI escape code - Sequence Elements

There is a single-character CSI (155/0x9B/0233) as well. The ESC+[ two-character sequence is more often used than the single-character alternative, for details see C0 and C1 control codes. Only the two-character sequence is recognized by devices that support just ASCII (7-bit bytes) or devices that support 8-bit bytes but use the 0x80–0x9F control character range for other purposes. On terminals that use UTF-8 encoding, both forms take 2 bytes (CSI in UTF-8 is 0xC2, 0x9B)[discuss] but the ESC+[ sequence is clearer.

Knowing the above 2 pieces of information this would make your escape sequence Esc+[+D which works out to be, big surprise, the backspace character.

excerpt - ANSI Escape sequences

Esc[ValueD     Cursor Backward: Moves the cursor back by the specified 
               number of columns without changing lines. If the cursor is 
               already in the leftmost column, ANSI.SYS ignores this 
               sequence.

References