Terminal Mode

This section is about the mode functionality of the Terminal.

Mode is composed with two types:

  • insert: When typing, it inserts the character/s at the cursor's position, forcing all characters past it one position further.

  • overwrite: When typing, overwrites any text that is present in the current location.

getTerminalsMode

Returns the current typing mode of the terminals.

Usage
Copy
getTerminalsMode(state: Object): String;
  • state Object

    Required. The global state of the application.

Returns
  • String

    Returns 'insert' or 'overwrite'.

Example
Copy
const state = storeHelper.getState();
const getTerminalsMode = selectorsHelper.make('getTerminalsMode');
const mode = getTerminalsMode(state);

replaceTerminalsMode

Replaces the typing mode of the terminals by the provided one.

Note: Dispatches an action with the type @orion/terminals-helper/REPLACE_TERMINALS_MODE which can be handled.
Usage
Copy
dispatchersHelper.dispatch('replaceTerminalsMode', { mode: String });
  • mode 'insert'|'overwrite'

    Required. The desired mode to replace.

Example
Copy
dispatchersHelper.dispatch('replaceTerminalsMode', { mode: 'insert' });
dispatchersHelper.dispatch('replaceTerminalsMode', { mode: 'overwrite' });

toggleTerminalsMode

Switches the current terminals mode between insert and overwrite.

If the current mode is insert and toggleTerminalsMode actions is dispatched, the current mode will be replaced with overwrite.

Note: Dispatches an action with the type @orion/terminals-helper/TOGGLE_TERMINALS_MODE which can be handled.
Usage
Copy
dispatchersHelper.dispatch('toggleTerminalsMode');
Example
Copy
dispatchersHelper.dispatch('toggleTerminalsMode');