Pad chat bar text buttons 12 px and add Alt+Y for floating chats
Model, mode and thinking buttons carry 12 px horizontal padding, replacing
the pill inset from 440995e3. Alt+Y (Option+Y by key position) toggles the
floating chats, like Alt+T for the terminal.
This commit is contained in:
@@ -225,4 +225,62 @@ void main() {
|
||||
await _chord(tester, LogicalKeyboardKey.controlLeft);
|
||||
expect(h.controller.floatShown, isTrue);
|
||||
});
|
||||
|
||||
testWidgets('Alt+Y floats, hides and shows like Ctrl+Y, also from a '
|
||||
'terminal', (tester) async {
|
||||
final h = await pump(tester);
|
||||
tester.state<_PaneState>(_pane('b')).focus.requestFocus();
|
||||
await tester.pump();
|
||||
await _chord(tester, LogicalKeyboardKey.altLeft);
|
||||
expect(h.controller.floatingPanes.firstOrNull?.sessionId, 'b');
|
||||
expect(h.controller.floatShown, isTrue);
|
||||
h.typing.requestFocus();
|
||||
await tester.pump();
|
||||
h.typed.clear();
|
||||
await _chord(tester, LogicalKeyboardKey.altLeft);
|
||||
expect(h.controller.floatShown, isFalse);
|
||||
expect(h.typed, isEmpty);
|
||||
});
|
||||
|
||||
test('Option+Y matches by key position; extra modifiers do not', () {
|
||||
// On a Mac, Option+Y produces ¥: the logical key is not Y.
|
||||
const yen = KeyDownEvent(
|
||||
physicalKey: PhysicalKeyboardKey.keyY,
|
||||
logicalKey: LogicalKeyboardKey(0x00a5),
|
||||
character: '¥',
|
||||
timeStamp: Duration.zero,
|
||||
);
|
||||
final keyboard = _FakeKeyboard({LogicalKeyboardKey.altLeft});
|
||||
expect(
|
||||
chatFloatShortcut(yen, keyboard, platform: TargetPlatform.macOS),
|
||||
isTrue,
|
||||
);
|
||||
const y = KeyDownEvent(
|
||||
physicalKey: PhysicalKeyboardKey.keyY,
|
||||
logicalKey: LogicalKeyboardKey.keyY,
|
||||
timeStamp: Duration.zero,
|
||||
);
|
||||
for (final extra in [
|
||||
LogicalKeyboardKey.controlLeft,
|
||||
LogicalKeyboardKey.metaLeft,
|
||||
LogicalKeyboardKey.shiftLeft,
|
||||
]) {
|
||||
expect(
|
||||
chatFloatShortcut(
|
||||
y,
|
||||
_FakeKeyboard({LogicalKeyboardKey.altLeft, extra}),
|
||||
),
|
||||
isFalse,
|
||||
reason: '$extra',
|
||||
);
|
||||
}
|
||||
expect(chatFloatShortcut(y, _FakeKeyboard({})), isFalse);
|
||||
});
|
||||
}
|
||||
|
||||
class _FakeKeyboard extends HardwareKeyboard {
|
||||
_FakeKeyboard(this.pressed);
|
||||
final Set<LogicalKeyboardKey> pressed;
|
||||
@override
|
||||
bool isLogicalKeyPressed(LogicalKeyboardKey key) => pressed.contains(key);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user