Control Functions, Escape Sequences, and VT-Keys

  • 7021621
  • 29-Sep-1999
  • 01-Apr-2018

Environment

Reflection for HP version 13.0 through 14.x
Reflection for UNIX and OpenVMS version 13.0 through 14.x
Reflection for ReGIS Graphics version 13.0 through 14.x

Situation

This technical note contains information about control functions, escape sequences, and VT-keys and how they interact with Reflection.

Resolution

Control functions sent by the host to a terminal cause specific actions, such as moving the text cursor, adding a line of text, assigning character attributes, and changing character sets.

There are four symbols used in this section that describe a sequence:

  • Csi stands for the Control Sequence Introduction character; when Reflection receives this character, it recognizes the string that follows as a control sequence.
  • Esc stands for the Escape character, and begins an escape sequence.
  • Dcs stands for the Device Control String character, and begins a device control sequence.
  • Ss3 stands for the Single Shift-3 character.

To use the functions, you must know what keystrokes send a sequence in a 7-bit environment.

In a terminal window, press the key or key combination shown below:

Esc
Press the Esc key.
Csi
Press the Esc+[ keys.
Dcs
Press the Esc+P keys.
Ss3
Press the Esc+O keys.

In a command line, enter the characters shown below:

Esc
Chr$(27)
Csi
Chr$(27) & "["
Dcs
Chr$(27) & "P"
Ss3
Chr$(27) & "O"

Note: The capital letters "P" and "O" are case sensitive.

Typical uses of escape sequences include keyboard remapping or scripting commands to simulate VT function- or numeric-key strokes. See the sample command at the end of this document.

Codes Sent by the Arrow Keys

The following table shows codes sent by the arrow keys. The codes sent in ANSI mode apply only to VT100-VT300 modes; the VT52 terminal is not compatible with ANSI mode.

Key
Numeric
ANSI Mode
Application

VT52 Mode
Cursor or Application

Up
CsiA
Ss3A
EscA
Dn
CsiB
Ss3B
EscB
Rt
CsiC
Ss3C
EscC
Lt
CsiD
Ss3D
EscD

Codes Sent by Editing and VT Function Keys

The following table shows the codes sent by the six editing keys and the VT function keys F6-F20 when you're in VT200 or VT300 mode (only three of the keys are recognized in VT52 and VT100 modes, as noted).

VT Keystroke
Generated Code
Find
Csi1~
Insert Here
Csi2~
Remove
Csi3~
Select
Csi4~
Prev Screen
Csi5~
Next Screen
Csi6~
F6
Csi17~
F7
Csi18~
F8
Csi19~
F9
Csi20~
F10
Csi21~
F11 (ESC)
Csi23~ (Esc in VT52/VT100 modes)
F12 (BS)
Csi24~ (Bs in VT52/VT100 modes)
F13 (LF)
Csi25~ (Lf in VT52/VT100 modes)
F14
Csi26~
F15 (Help)
Csi28~
F16 (Do)
Csi29~
F17
Csi31~
F18
Csi32~
F19
Csi33~
F20
Csi34~

Codes Sent by the Numeric Keypad

The following table shows the codes sent by the numeric keypad keys.

The codes sent in ANSI mode apply only to VT100-VT300 modes; the VT52 terminal is not compatible with ANSI mode.

Key
Numeric
ANSI Mode
Application

Numeric
VT52 Mode
Application

0
0
Ss3p
0
Esc?p
1
1
Ss3q
1
Esc?q
2
2
Ss3r
2
Esc?r
3
3
Ss3s
3
Esc?s
4
4
Ss3t
4
Esc?t
5
5
Ss3u
5
Esc?u
6
6
Ss3v
6
Esc?v
7
7
Ss3w
7
Esc?w
8
8
Ss3x
8
Esc?x
9
9
Ss3y
9
Esc?y
-
(minus)
Ss3m
-
Esc?m
,
(comma)
Ss3l
,
Esc?l
.
(period)
Ss3n
.
Esc?n
Enter
Cr or
Ss3M
Cr or
Esc?M
 
CrLf
 
CrLf
 
PF1
Ss3P
Ss3P
EscP
EscP
PF2
Ss3Q
Ss3Q
EscQ
EscQ
PF3
Ss3R
Ss3R
EscR
EscR
PF4
Ss3S
Ss3S
EscS
EscS

Sample Command

To access a command line in Reflection, press Alt+L. Enter a command to transmit a control function or escape sequence, such as the sample command shown below:

.Transmit Chr$(27) & "OP"

Additional Information

For complete documentation of control functions and escape sequences, see the Reflection VT Terminal Reference at https://docs.attachmate.com/reflection/14.0/rvtref.pdf.

Legacy KB ID

This document was originally published as Attachmate Technical Note 1364.