Terminal Messages

Input

INPUT T(3000) termid clientid data

Send terminal input.

MOUSE_INPUT T(3001) termid clientid mouseflags x y

Send mouse input.

  • termid (16): The destination terminal identifier.
  • clientid (16): The originating client identifier.
  • mouseflags (4): The low order byte is the index of the mouse button pressed, if any. The remaining bytes are the mouse event flags.
  • x (4): The pointer x position in character cells.
  • y (4): The pointer y position in character cells.

General

RESIZE_TERM T(3104) termid clientid size

Resize a terminal.

  • termid (16): The destination terminal identifier.
  • clientid (16): The originating client identifier.
  • width (4): The terminal width in character cells.
  • height (4): The terminal height in character cells.
BUFFER_CAPACITY T(3002) termid clientid order+bufid

Resize the scrollback buffer.

CONTENT_REQUEST T(3008) termid clientid start8 end8 bufid

Request terminal row and region content. The replies will be delivered as a state update block using the message types BEGIN_OUTPUT_RESPONSE and END_OUTPUT_RESPONSE.

CLOSE_TERM T(3105) termid clientid

Close a terminal.

REMOVE_TERM T(3105) termid code

Sent to the client when a terminal has closed.

Removal announcements for all downstream terminals and servers should be sent prior to receiving this message, but clients must gracefully handle a bad ordering.

REMOVE_CONN T(3106) termid code

As REMOVE_TERM, but names a connection rather than a terminal.

DUPLICATE_TERM T(3106) termid clientid newid width height key+value...

Create a new terminal by duplicating an existing terminal on the same server. The scrollback buffer contents are copied to the new terminal.

  • termid (16): The existing terminal's terminal identifier.
  • clientid (16): The originating client identifier.
  • termid (16): The new terminal's terminal identifier.
  • width (4): The width of the new terminal in character cells.
  • height (4): The height of the new terminal in character cells.
  • key+value: The new terminal's attributes as NUL-terminated UTF-8 strings.
RESET_TERM T(3107) termid clientid flags

Reset a terminal.

CHANGE_OWNER T(3108) termid clientid

Assign ownership of a terminal to the originating client.

REQUEST_DISCONNECT T(3109) termid clientid

Disconnect a connection hosted by the named terminal or connection. In the case of a connection, this is equivalent to REMOVE_CONN.

TOGGLE_SOFT_SCROLL_LOCK T(3110) termid clientid

Toggle scroll lock within a terminal. This causes the server to stop reading input from the terminal driver. This is independent of the "hard" scroll lock that can be set in the terminal driver using the STOP character (normally DC3, Ctrl+S).

SEND_SIGNAL T(3111) termid clientid signal

Send a signal to the terminal's foreground process group.

State Updates

BEGIN_OUTPUT T(3000) termid

Begins a terminal state update block. The message numbers that fall between here and END_OUTPUT are always reported within a state update block.

BEGIN_OUTPUT_RESPONSE C(3000) clientid termid

As BEGIN_OUTPUT, but includes the identifier of the requesting client. This message is sent in response to a CONTENT_REQUEST or GET_REGION by the client.

FLAGS_CHANGED T(3001) termid flags8

Reports a change in terminal flags.

BUFFER_CAPACITY T(3002) termid rows8 order+bufid

Reports a change in buffer capacity. This is the buffer's maximum number of saved rows and is a power of 2. If the buffer size exceeds this number, its topmost rows are lost.

  • termid (16): The originating terminal identifier.
  • rows8 (8): The new size of the buffer.
  • order+bufid (4): The low-order byte is the buffer identifier. The next byte is the new buffer capacity exponent (power of 2). The high-order bit of that byte is set if scrollback is disabled in the buffer.
BUFFER_LENGTH T(3003) termid rows8 bufid

Reports a change in buffer size. A buffer grows when new rows are added and shrinks when the terminal is reset or (in some cases) when the terminal is resized to a smaller size. If scrollback is disabled in a buffer, the buffer size will track the terminal size.

The buffer size includes the rows on the terminal screen itself. The buffer size can exceed the buffer capacity in which case the rows between zero and size - capacity are lost.

BUFFER_SWITCHED T(3004) termid bufid

Reports a change in the active buffer. This occurs when alternate screen mode is entered or exited.

SIZE_CHANGED T(3005) termid size margins

Reports a change in terminal size.

  • termid (16): The originating terminal identifier.
  • width (4): The terminal width in character cells.
  • height (4): The terminal height in character cells.
  • marginx (4): The terminal's left margin in character cells.
  • marginy (4): The terminal's top margin in character cells.
  • marginw (4): The terminal's margin width in character cells.
  • marginh (4): The terminal's margin height in character cells.
CURSOR_MOVED T(3006) termid x y pos flags+subpos

Reports a change in terminal cursor position.

  • termid (16): The originating terminal identifier.
  • x (4): The cursor x position in character cells.
  • y (4): The cursor y position in character cells.
  • pos (4): The character position of the cursor within the row.
  • flags+subpos (4): The low order byte is the cursor sub-position (number of combining characters received). The remaining bytes are the cursor flags.
BELL_RANG T(3007) termid type count

Reports one or more bell rings.

  • termid (16): The originating terminal identifier.
  • type (4): The bell type, currently always set to zero.
  • count (4): The number of bell rings.
ROW_CONTENT T(3008) termid rownum8 flags+bufid modtime nranges range... string

Reports terminal row content.

  • termid (16): The originating terminal identifier.
  • rownum8 (8): The row number. This should be bounds checked against the buffer size. Due to a race condition, it's possible for row updates to arrive before the corresponding buffer size update. These out-of-bounds row updates should be ignored.
  • flags+bufid (4): The low order byte is the buffer identifier. The remaining bytes are the line flags.
  • modtime (4): The row modification time in tenths of a second, or INT32_MIN when the row has no modification time.
  • nranges (4): The number of cell ranges in the next field.
  • range: Cell ranges, each consisting of six 4-byte numbers: starting character position, ending character position, cell flags, foreground color, background color, and hyperlink region identifier.
  • string: The row text as a UTF-8 string.
ROW_CONTENT_RESPONSE C(3008) clientid termid rownum8 flags+bufid modtime nranges range... string

As ROW_CONTENT, but includes the identifier of the requesting client. This message is sent in response to a CONTENT_REQUEST by the client.

REGION_UPDATE T(3009) termid regid type+bufid flags parent srow8 erow8 scol ecol key+value...

Reports a new or updated terminal region.

REGION_UPDATE_RESPONSE C(3009) clientid termid regid type+bufid flags parent srow8 erow8 scol ecol key+value...

As REGION_UPDATE, but includes the identifier of the requesting client. This message is sent in response to a CONTENT_REQUEST or GET_REGION by the client.

DIRECTORY_UPDATE T(3010) termid time8 name key+value...

Reports a change of the terminal's current directory.

  • termid (16): The originating terminal identifier.
  • time8 (8): The time of the update in milliseconds since the Epoch.
  • name: The directory name as a NUL-terminated UTF-8 string.
  • key+value: Directory attributes as NUL-terminated UTF-8 strings.
FILE_UPDATE T(3011) termid mtime8 size8 mode uid gid name key+value...

Reports a file change within the terminal's current directory.

  • termid (16): The originating terminal identifier.
  • mtime8 (8): The file modification time in milliseconds since the Epoch.
  • size8 (8): The file size.
  • mode (4): The file mode bits.
  • uid (4): The file UID.
  • gid (4): The file GID.
  • name: The file name as a NUL-terminated UTF-8 string.
  • key+value: File attributes as NUL-terminated UTF-8 strings.
FILE_REMOVED T(3012) termid mtime8 name

Reports a file deletion within the terminal's current directory.

  • termid (16): The originating terminal identifier.
  • mtime8 (8): The time of the update in milliseconds since the Epoch.
  • name: The file name as a NUL-terminated UTF-8 string.
END_OUTPUT T(3013) termid

Ends a terminal state update block.

END_OUTPUT_RESPONSE C(3013) clientid termid

As END_OUTPUT, but includes the identifier of the requesting client.

MOUSE_MOVED T(3014) termid x y

Reports movement of the terminal mouse pointer.

  • termid (16): The originating terminal identifier.
  • x (4): The pointer x position in character cells.
  • y (4): The pointer y position in character cells.

Attributes

GET_TERM_ATTRIBUTES S(3100) termid clientid

Request terminal or connection attributes. Attribute names starting with underscore (_) will not be included in the response.

TERM_ATTRIBUTES_RESPONSE C(3100) clientid termid key+value...

Response to a GET_TERM_ATTRIBUTES request, if the target is a terminal.

CONN_ATTRIBUTES_RESPONSE C(3101) clientid termid key+value...

Response to a GET_TERM_ATTRIBUTES request, if the target is a connection. As TERM_ATTRIBUTES_RESPONSE.

GET_TERM_ATTRIBUTE T(3101) termid clientid key...

Request one or more terminal or connection attributes. A separate response will be sent for each requested attribute.

TERM_ATTRIBUTE_CHANGED T(3101) termid key[+value]

Sent to the client when a terminal attribute has changed.

  • termid (16): The originating terminal identifier.
  • key[+value]: The attribute name and optional value as NUL-terminated UTF-8 strings. If the value is absent, the attribute was removed.
CONN_ATTRIBUTE_CHANGED T(3101) termid key[+value]

Sent to the client when a connection attribute has changed. As TERM_ATTRIBUTE_CHANGED.

TERM_ATTRIBUTE_RESPONSE C(3103) clientid termid key[+value]

As TERM_ATTRIBUTE_CHANGED, but includes the identifier of the requesting client.

CONN_ATTRIBUTE_RESPONSE C(3104) clientid termid key[+value]

As CONN_ATTRIBUTE_CHANGED, but includes the identifier of the requesting client.

SET_TERM_ATTRIBUTE T(3102) termid clientid key+value...

Set one or more terminal or connection attributes. This will cause TERM_ATTRIBUTE_CHANGED or CONN_ATTRIBUTE_CHANGED messages to be sent to all clients unless the attribute(s) did not change.

  • termid (16): The destination terminal identifier.
  • clientid (16): The originating client identifier.
  • key+value: The attribute names and new values as NUL-terminated UTF-8 strings.
REMOVE_TERM_ATTRIBUTE T(3103) termid clientid key...

Remove one or more terminal or connection attributes. This will cause TERM_ATTRIBUTE_CHANGED or CONN_ATTRIBUTE_CHANGED messages to be sent to all clients unless the attribute(s) did not change.

Inline Content

IMAGE_CONTENT T(3015) termid clientid contentid

Download an inline content item. If the size of the content item is more than 500KiB, a DOWNLOAD_IMAGE task should be used to download the content item instead.

IMAGE_CONTENT_RESPONSE C(3015) clientid termid contentid data
DOWNLOAD_IMAGE T(3016) termid clientid taskid contentid chunksize windowsize

Create a task to download a content item.

TODO more documentation.

Regions

CREATE_REGION T(3200) termid clientid bufid type srow8 erow8 scol ecol key+value...

Create an annotation region. The server will assign the region identifier and report the new region via REGION_UPDATE in a state update block.

GET_REGION T(3201) termid clientid bufid regid

Request information on a given region. The reply will be delivered as a state update block using the message types BEGIN_OUTPUT_RESPONSE and END_OUTPUT_RESPONSE.

REMOVE_REGION T(3202) termid clientid bufid regid

Remove a region created via CREATE_REGION.