Terminal surface: lazy activation, settings mode choice, open in terminal, tests
This commit is contained in:
@@ -55,14 +55,22 @@ class _TerminalSurfaceState extends State<TerminalSurface>
|
||||
void initState() {
|
||||
super.initState();
|
||||
HardwareKeyboard.instance.addHandler(_key);
|
||||
widget.layout.addListener(_layoutChanged);
|
||||
// A terminal left shown before a reload reattaches at once.
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) => _layoutChanged());
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
HardwareKeyboard.instance.removeHandler(_key);
|
||||
widget.layout.removeListener(_layoutChanged);
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
void _layoutChanged() {
|
||||
if (mounted && widget.layout.visible && !_narrow) widget.hub.activate();
|
||||
}
|
||||
|
||||
bool get _narrow => MediaQuery.sizeOf(context).width < terminalNarrowWidth;
|
||||
|
||||
/// The shortcut is handled before the focused widget, so it toggles even
|
||||
@@ -98,6 +106,7 @@ class _TerminalSurfaceState extends State<TerminalSurface>
|
||||
}
|
||||
|
||||
Future<void> _openPage() async {
|
||||
widget.hub.activate();
|
||||
if (_pageOpen) return;
|
||||
_pageOpen = true;
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user