enter method
Enters full-screen mode (alternate screen + raw input).
With mouseWheel, also asks the terminal to report the mouse wheel, which
the KeyDecoder turns into KeyType.wheelUp/KeyType.wheelDown. It is
opt-in because while it is on most terminals stop selecting text on a
plain drag and pasting on a middle-click (with Shift held — Option/Fn on
macOS — both still work).
Implementation
@override
void enter({bool mouseWheel = false}) {
onEnter();
// Alternate screen on, clear, cursor home, hide cursor.
// A re-enter without a leave() between (only [Terminal] guards against
// that) must not strand mouse mode on with the flag cleared, or leave()
// would never turn it off; so switch it off here when it is no longer
// wanted.
final mouse = mouseWheel ? _mouseOn : (_mouseWheelEnabled ? _mouseOff : '');
writeAnsi('\x1b[?1049h\x1b[2J\x1b[H\x1b[?25l$mouse');
_mouseWheelEnabled = mouseWheel;
_front = null;
}