Renderer for nero-terminal's Tera Term-style window.

Architecture:

  • one persistent xterm terminal (module:renderer/renderer~ensureTerminal) created at startup and always shown, so it always renders (it is never hidden/re-shown — that previously broke xterm's first paint);
  • the session configuration is an overlay dialog over the terminal, shown at startup and reopenable from the title-bar gear button;
  • module:renderer/renderer~startSession opens a session through window.sessionAPI, then pipes window.terminalAPI bytes into the view;
  • UI text is localised via I18n (data-i18n attributes + t()), and the light/dark theme uses Bootstrap's data-bs-theme.

The terminal backends (PTY/SSH) and the xterm wrapper come from the shared libraries under nero_modules/.

Methods

(inner) applyLiveTerminalOptions()

Apply the current appearance settings (font, cursor, scrollback, colour theme) to the live persistent terminal immediately, without reopening the session — so changes such as a larger font are reflected at once, even mid-session.

(inner) closeSettings()

Hide the configuration overlay and return focus to the terminal.

(inner) ensureTerminal()

Create the single, persistent TerminalView (xterm + fit + canvas renderer) once and mount it into #terminal. Idempotent. Because the terminal is created while visible and never hidden, xterm always paints correctly.

(inner) flash(msg, isError)

Show a transient message in the dialog footer.

Parameters:
NameTypeDescription
msgstring

Message text (empty to clear).

isErrorboolean

Red (error) when true, muted (info) otherwise.

(inner) formToProfile() → {object}

Snapshot the configuration form into a SessionProfile-shaped object, used both for saving and for opening a session.

Returns:
Type: 
object

(async, inner) init() → {Promise.<void>}

Bootstrap the renderer: localise the static DOM and wire the language picker, create the persistent terminal, attach every event handler synchronously (so the buttons work even if async setup is slow or fails), populate the colour-theme and installed-font pickers, show the settings overlay, then load the detected shells and saved sessions.

Returns:
Type: 
Promise.<void>

(async, inner) openProfileByName(name) → {Promise.<void>}

Load a saved session profile by name and start it immediately. Invoked when a Windows jump-list entry (or a --open-profile launch argument) selects a saved session; shows the settings dialog if the profile is missing.

Parameters:
NameTypeDescription
namestring

the saved session's name.

Returns:
Type: 
Promise.<void>

(inner) openSettings()

Show the session-configuration overlay over the terminal and focus the host field.

(inner) resolveLaunch(p) → {object}

Turn a form snapshot into the payload for window.sessionAPI.open, plus a short display label for the title bar. Throws a localised Error if a required field (SSH host, or a custom command / shell) is missing.

Parameters:
NameTypeDescription
pobject

form values from formToProfile

Returns:

a sessionAPI.open payload with type, connection fields and a display label.

Type: 
object

(inner) setUiTheme(theme)

Apply the Bootstrap light/dark UI theme, swap the moon/sun icon, and ask the main process to recolour the native title-bar overlay to match.

Parameters:
NameTypeDescription
theme'dark' | 'light'

(inner) settingsOpen() → {boolean}

Returns:

whether the configuration overlay is currently shown.

Type: 
boolean

(async, inner) startDefaultSession() → {Promise.<void>}

Open the default local shell immediately, skipping manual configuration. Backs the "open the default terminal at startup" toggle (and is a sensible fallback when a requested profile cannot be opened).

Returns:
Type: 
Promise.<void>

(async, inner) startSession() → {Promise.<void>}

Open a session for the current form values and connect it to the persistent terminal. Tears down any previous session, applies per-session xterm options (font / theme / scrollback / cursor) and resets the screen, buffers early output until the view is ready, then pipes terminalAPI ⇄ the view and closes the overlay. Validation / connection errors are shown inline via flash.

Returns:
Type: 
Promise.<void>