VtTerminal constructor
VtTerminal({})
A width x height normal screen showing history, the last line
with its line break when atLineStart. The history is guarded: the
emulator fails on any write to it, and on any absolute row. Input is
decoded by a HeadlessTerminal.
Implementation
VtTerminal({
int width = 40,
int height = 10,
this.history = const [],
bool atLineStart = true,
}) : _input = HeadlessTerminal(width: width, height: height),
vt = Vt(
width,
height,
scrollback: true,
allowLineFeed: true,
relativeOnly: true,
) {
for (var i = 0; i < history.length; i++) {
vt.feed(utf8.encode(history[i]));
if (atLineStart || i < history.length - 1) {
vt.feed(const [0x0D, 0x0A]);
}
}
vt.guardRows(atLineStart ? vt.cy : vt.cy + 1);
info = TerminalInfo(
caps: const TerminalCaps(),
textMode: TextMode.graphemes,
ambiguousWidth: 1,
colorMode: ColorMode.trueColor,
foregroundRgb: null,
backgroundRgb: null,
inBandResize: false,
graphemeMode: false,
kittyKeyboard: false,
answeredQueries: true,
alternateScreen: false,
cursorColumn: vt.cx,
);
}