Terminal Dimensions

The terminal is composed by lines and columns, and its dimensions are based on the same.

The Terminal's dimensions are: maxLines, maxColumns and lastLine.

getTerminalDimensions

Retrieves the Dimensions of a Terminal.

The Dimensions is composed by:

  • maxLines Number

    The maximum number of lines. This value is incremented when new lines are added.

  • maxColumns Number

    The maximum number of columns. This value is static, it's 68 by default.

  • lastLine Number

    The number of the last line which has characters.

Copy
getTerminalDimensions(state: Object, { terminalId: String }): Dimensions;
  • state Object

    Required. The global state of the application.

  • terminalId String

    Required. The ID of the Terminal to retrieve its dimensions.

Returns
  • Dimensions

  • The dimensions of the Terminal. Composed by maxLines, maxColumns, and lastLine.

Example
Copy
const state = storeHelper.getState();
const getTerminalDimensions = selectorsHelper.make('getTerminalDimensions');
const dimensions = getTerminalDimensions(state, {
terminalId: 'terminal-1',
});