openInline method
Opens the terminal an inline twk app runs on, in the interactive
mode: raw input, the normal screen. Called when the Cli's inline
session starts, and again for a new one once a Ctrl+C ended the last
(its terminal closed by then); the app closes it when the session
ends.
Implementation
@override
Future<TerminalBackend> openInline() async {
final last = _backend;
if (last != null && !last.closed) {
throw StateError('the inline terminal is open: one at a time');
}
_opened++;
// the last one's frames on the screen, then the new one's from its first
_feedFrames();
_frames = 0;
screen.guardRows(screen.cy);
final backend = _backend = HeadlessTerminal(
width: width,
height: height,
caps: TerminalCaps(styledUnderlines: _probedUnderlines),
options: const TerminalOptions(alternateScreen: false),
cursorColumn: screen.cx,
progressReports: progressReports,
);
for (final keys in _input) {
backend.type(keys);
}
_input.clear();
return backend;
}