Skip to content

vtf iodata

srccircumflex edited this page Apr 24, 2023 · 10 revisions

↑ vtframework

iodata

This module contains the input and output data (-types) of the framework.

Data types that are generated for the interpretation of inputs from the stdin stream can be used as reference objects from this module. (see also vtiinterpreter, binder and input). All data types that are primarily available as output types are subclasses of EscSegment; this in itself is a subclass of str and contains special features for handling escape sequences.

New since version [v] 2023.04.24-2:
EscSegment and EscContainer both additionally inherit from type EscString.

Structure of the data types

output basic type:

module esccontainer
├─ class EscSegment(EscString)
└─ class EscContainer(EscString)

primarily input:

module chars
└─ class Char
        ├─ class ASCII
        │        └─ class Space
        ├─ class UTF8
        └─ class Pasted

primarily output but used exclusively as input type:

module c1ctrl
├─ class UnknownESC
└─ class ManualESC

exclusively input:

module keys
└─ class Key
        ├── class NavKey
        ├── class ModKey
        ├── class KeyPad
        ├── class DelIns
        ├── class FKey
        ├── class EscEsc
        ├── class Ctrl
        └── class Meta

module mouse
└─ class Mouse

module replies
└─ class Reply
        ├── class ReplyDA
        ├── class ReplyTID
        ├── class ReplyTIC
        ├── class ReplyCP
        ├── class ReplyCKS
        ├── class ReplyDECPM
        ├── class ReplyWindow
        └── class ReplyOSColor

primarily output:

module c1ctrl
├─ class FsFpnF
└─ class Fe
        ├── class CSI
        │      ├── class SGRSeqs [w]
        │      ├── class SGRReset [w]
        │      └── class SGRWrap [w]
        ├── class SS3
        ├── class DCS
        ├── class OSC
        └── class APP

The creation of other output types is implemented via static factory methods in categorized modules and classes.

Output escape sequences factories:

module cursor
├─ class CursorSave [w]
│       ├── save
│       └── restore
├─ class CursorStyle [u]
│       ├── blinking_block
│       ├── default
│       ├── steady_block
│       ├── blinking_underline
│       ├── steady_underline
│       ├── blinking_bar
│       └── steady_bar
├─ class CursorNavigate [w]
│       ├── up
│       ├── down
│       ├── forward
│       ├── back
│       ├── nextline
│       ├── preline
│       ├── column
│       ├── position
│       ├── tab_stop_set
│       ├── tab_column_clear
│       ├── tab_all_clear
│       ├── tab_forward
│       ├── tab_back
│       ├── line_absolute
│       ├── line_relative
│       ├── positionf
│       ├── reverse_index
│       └── next_index
└─ class Scroll [w]
        ├── up
        ├── down
        └── set_region

module decpm
└─ class DECPrivateMode [d]
        ├── high
        └── low

module os
├─ class CtrlByteConversion
│       └── conversion
├─ class WindowManipulation
│       ├── resize
│       ├── resizeln
│       ├── change_ico_n_title [w]
│       └── change_title [w]
└─ class OSColorControl [u]
        ├── set_rel_color [w]
        ├── reset_rel_color
        ├── set_environment_color [o]
        ├── reset_environment_color
        ├── set_cursor_color [o]
        ├── reset_cursor_color
        ├── set_highlight_color
        ├── reset_highlight_color
        ├── set_pointer_color
        └── reset_pointer_color

module requests
├─ class RequestDevice [u]
│       ├── termattr_DA [w]
│       ├── termid_TIC
│       ├── termuid_TID
│       └── checksum_CKS
├─ class RequestGeo [u]
│       ├── cursorpos_CP [w]
│       └── window
├─ class RequestDECPM [u]
│       └── privmode_DECPM
└─ class RequestOSColor [u]
        ├── rel
        ├── environment
        ├── cursor
        ├── highlight
        └── pointer

module textctrl
├─ class Erase [w]
│       ├── display_below
│       ├── display_above
│       ├── display
│       ├── display_lines
│       ├── line_right
│       ├── line_left
│       ├── line
│       └── terminal
├─ class TextModification [u]
│       ├── chr_pos_rel
│       ├── chr_pos_abs
│       ├── ins_chr [w]
│       ├── del_chr [w]
│       ├── erase_chr [w]
│       ├── ins_ln [w]
│       └── del_ln [w]
└─ class CharSet [u] [c]
        ├── invoke
        ├── select
        ├── designateG0_VT100
        ├── designateG1_VT100
        ├── designateG2_VT220
        ├── designateG3_VT220
        ├── designateG1_VT300
        ├── designateG2_VT300
        └── designateG3_VT300

Further Information

ANSI escape sequences - General

ANSI escape sequences or ANSI escape codes are character sequences for screen control, preceded by the escape character (ASCII 27 "\x1b"); these control sequences were not understood by the terminals of that time and are not understood by today's emulators as the input of text, but are tapped by the system for an internal function.

The standard was developed and defined in the 1970s by the American National Standards Institute (ANSI) and Ecma International (ECMA). The first terminal to implement the standard was the DEC-VT100 in 1978. Due to the wide distribution of the VT100, already at that time the successor models and imitators oriented themselves at its system, which has developed up to the present time as a facto standard for the terminal emulation.

Both the scope and the processing of escape sequences have of course evolved over the years, so that some designations are outdated and functions of the sequences are obsolete today, are simply no longer implemented in emulators or exceed the program's privileges. For example, the designation of the control character "Operating System Command" (OSC) is probably no longer accurate in today's emulators. Nevertheless, the most widespread and useful functions have survived until today and even Microsoft was persuaded to implement a number of the most popular sequences in the cmd. First of all the sequences for colored text (SGR) and the positioning of the cursor.

About the structure of the control sequences. These always consist of a control character (which consists of two characters), a parameter part of defined or undefined length and a terminating character whose code area or as control character ("<ESC>\" ) is defined by the introductory control character at the beginning.

Example using the "Select Graphic Rendition" (SGR) sequence for green text on white background:

 <ESC> [  32 ; 47  m
└─┬─────┘└──┬────┘└┬┘
  │         │    Terminating character
  │      Parameter part
 Control character (in this case the "Control Sequence Introducer" CSI)
Support of escape sequences by the emulator

Traditionally, escapes sequences are supported more extensively by the emulators under UNIX systems, but the modules also contain sequences that are mostly ignored by the emulator. Microsoft supports a comparatively small but sufficient subset of ANSI escape sequences in cmd (note: by default, processing of escape sequence output and input as escape sequence is disabled in cmd, see vtermios).

[w] (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22) In the listings above, the sequences marked with [w] are those that are supported by the console according to Microsoft's documentation. These are usually also usable under UNIX systems.
[u] (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14) Markings with [u] are usually usable under UNIX systems.
[c] The Windows cmd supports two G0 character sets. 'USASCII' and 'DEC Special Characters and Line Drawing'.
[o] (1, 2, 3, 4) The effect of sequences marked with [o] has been observed with some limitations on Windows cmd (see below) and are generally UNIX compatible.

Observed support in the Windows cmd:

  • set_environment_color: works only as a background color for used cells of the console
  • set_cursor_color: works
  • DEC Private Mode > Mouse support: works, slower than under UNIX
[d] See below for a separate listing of DEC private mode id's supports.

DEC Private Mode Id Supports (excerpt, categorized):

Mouse: [o] [u]
  • 9 : Send Mouse X & Y on button press. (X10 xterm mouse protocol)
  • 1000 : Send Mouse X & Y on button press and release. See the section Mouse Tracking. This is the X11 xterm mouse protocol.
  • 1001 : Use Highlight Mouse Tracking, xterm. (eq. to 1000)
  • 1002 : Use Cell Motion Mouse Tracking, xterm.
  • 1003 : Use All Motion Mouse Tracking, xterm.
Extended Mouse Coordinates (supported by the vtiinterpreter): [u]
  • 1006 : Enable SGR Mouse Mode, xterm.
  • 1016 : Enable SGR Mouse PixelMode, xterm.
Screen: [u]
  • 5 : Reverse Video (DECSCNM), VT100.
  • 1046 : Switching to/from Alternate Screen Buffer, xterm. This works for terminfo-based systems, updating the titeInhibit resource.
  • 1047 : Use Alternate Screen Buffer, xterm. This may be disabled by the titeInhibit resource.
  • 1049 : Save cursor as in DECSC, xterm. After saving the cursor, switch to the Alternate Screen Buffer, clearing it first. This may be disabled by the titeInhibit resource. This control combines the effects of the 1 0 4 7 and 1 0 4 8 modes. Use this with terminfo-based applications rather than the 4 7 mode. [w]
Cursor: [u]
  • 7 : Auto-Wrap Mode (DECAWM), VT100.
  • 12 : Blinking cursor (AT&T 610). [w]
  • 13 : Blinking cursor (set only via resource or menu).
  • 14 : Enable XOR of blinking cursor control sequence and menu.
  • 25 : Show cursor (DECTCEM), VT220. [w]
  • 1048 : Save cursor as in DECSC, xterm. This may be disabled by the titeInhibit resource.
Modes: [u]
  • 1 : Application Cursor Keys (DECCKM), VT100. [w]
  • 2004 : Set bracketed paste mode, xterm.
UTF-8 Table
UTF-8
0 1 2 3 4 5 6 7 8 9 A B C D E F
0x NUL SOH STX ETX EOT ENQ ACK BEL BS HT LF VT FF CR SO SI
1x DLE DC1 DC2 DC3 DC4 NAK SYN ETB CAN EM SUB ESC FS GS RS US
2x  SP  ! " # $ % & ' ( ) * + , - . /
3x 0 1 2 3 4 5 6 7 8 9 : ; < = > ?
4x @ A B C D E F G H I J K L M N O
5x P Q R S T U V W X Y Z [ \ ] ^ _
6x ` a b c d e f g h i j k l m n o
7x p q r s t u v w x y z { | } ~ DEL
8x
9x
Ax
Bx
Cx 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
Dx 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
Ex 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
Fx 4 4 4 4 4 4 4 4 5 5 5 5 6 6

Resources:

Date: 06 Nov 2022
Version: 0.1
Author: Adrian Hoefflin [srccircumflex]

Clone this wiki locally