feat: shift key in ssh term (#819)

This commit is contained in:
lollipopkit🏳️‍⚧️
2025-07-17 18:18:18 +08:00
committed by GitHub
parent a35d21981b
commit c6439673b8
11 changed files with 63 additions and 28 deletions

View File

@@ -21,6 +21,7 @@ enum VirtKey {
right,
clipboard,
ime,
shift,
pgup,
pgdn,
slash,
@@ -105,6 +106,7 @@ extension VirtKeyX on VirtKey {
VirtKey.right,
VirtKey.clipboard,
VirtKey.ime,
VirtKey.shift,
];
/// Corresponding [TerminalKey]
@@ -119,6 +121,7 @@ extension VirtKeyX on VirtKey {
VirtKey.left => TerminalKey.arrowLeft,
VirtKey.down => TerminalKey.arrowDown,
VirtKey.right => TerminalKey.arrowRight,
VirtKey.shift => TerminalKey.shift,
VirtKey.pgup => TerminalKey.pageUp,
VirtKey.pgdn => TerminalKey.pageDown,
VirtKey.f1 => TerminalKey.f1,
@@ -161,7 +164,7 @@ extension VirtKeyX on VirtKey {
};
bool get toggleable => switch (this) {
VirtKey.alt || VirtKey.ctrl => true,
VirtKey.alt || VirtKey.ctrl || VirtKey.shift => true,
_ => false,
};

View File

@@ -23,6 +23,15 @@ class VirtKeyProvider extends TerminalInputHandler with ChangeNotifier {
}
}
bool _shift = false;
bool get shift => _shift;
set shift(bool value) {
if (value != _shift) {
_shift = value;
notifyListeners();
}
}
void reset(TerminalKeyboardEvent e) {
if (e.ctrl) {
ctrl = false;
@@ -30,6 +39,9 @@ class VirtKeyProvider extends TerminalInputHandler with ChangeNotifier {
if (e.alt) {
alt = false;
}
if (e.shift) {
shift = false;
}
notifyListeners();
}
@@ -38,6 +50,7 @@ class VirtKeyProvider extends TerminalInputHandler with ChangeNotifier {
final e = event.copyWith(
ctrl: event.ctrl || ctrl,
alt: event.alt || alt,
shift: event.shift || shift,
);
if (Stores.setting.sshVirtualKeyAutoOff.fetch()) {
reset(e);

View File

@@ -3,6 +3,6 @@
abstract class BuildData {
static const String name = "ServerBox";
static const int build = 1189;
static const int build = 1195;
static const int script = 64;
}