Skip to content

Commit b767246

Browse files
TeigenTeigen
authored andcommitted
Merge branch 'feat/mobile-shift-tab' into dev
2 parents cd49171 + f277f96 commit b767246

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

src/web/public/keyboard-accessory.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Defines two exports:
55
*
66
* - KeyboardAccessoryBar (singleton object) — Quick action buttons shown above the virtual
7-
* keyboard on mobile: arrow up/down, /init, /clear, /compact, paste, and dismiss.
7+
* keyboard on mobile: arrow up/down, Shift+Tab, /init, /clear, /compact, paste, and dismiss.
88
* Destructive actions (/clear, /compact) require double-tap confirmation (2s amber state).
99
* Commands are sent as text + Enter separately for Ink compatibility.
1010
* Only initializes on touch devices (MobileDetection.isTouchDevice guard).
@@ -53,6 +53,7 @@ const KeyboardAccessoryBar = {
5353
<path d="M19 9l-7 7-7-7"/>
5454
</svg>
5555
</button>
56+
<button class="accessory-btn" data-action="shift-tab" title="Shift+Tab">⇧Tab</button>
5657
<button class="accessory-btn" data-action="init" title="/init">/init</button>
5758
<button class="accessory-btn" data-action="clear" title="/clear">/clear</button>
5859
<button class="accessory-btn" data-action="compact" title="/compact">/compact</button>
@@ -80,7 +81,7 @@ const KeyboardAccessoryBar = {
8081
this.handleAction(action, btn);
8182

8283
// Refocus terminal so keyboard stays open (tap blurs terminal → keyboard dismisses → toolbar shifts)
83-
if ((action === 'scroll-up' || action === 'scroll-down') ||
84+
if ((action === 'scroll-up' || action === 'scroll-down' || action === 'shift-tab') ||
8485
((action === 'clear' || action === 'compact') && this._confirmAction)) {
8586
if (typeof app !== 'undefined' && app.terminal) {
8687
app.terminal.focus();
@@ -109,6 +110,9 @@ const KeyboardAccessoryBar = {
109110
case 'scroll-down':
110111
this.sendKey('\x1b[B');
111112
break;
113+
case 'shift-tab':
114+
this.sendKey('\x1b[Z');
115+
break;
112116
case 'init':
113117
this.sendCommand('/init');
114118
break;

src/web/public/mobile.css

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -886,7 +886,8 @@ html.mobile-init .file-browser-panel {
886886
padding-right: calc(8px + var(--safe-area-right));
887887
gap: 8px;
888888
align-items: center;
889-
justify-content: center;
889+
overflow-x: auto;
890+
-webkit-overflow-scrolling: touch;
890891
z-index: 51;
891892
transition: transform 0.15s ease-out;
892893
will-change: transform;
@@ -896,10 +897,16 @@ html.mobile-init .file-browser-panel {
896897
display: flex;
897898
}
898899

900+
/* 隐藏滚动条但保留滑动能力 */
901+
.keyboard-accessory-bar::-webkit-scrollbar {
902+
display: none;
903+
}
904+
899905
.accessory-btn {
900906
display: inline-flex;
901907
align-items: center;
902908
justify-content: center;
909+
flex-shrink: 0;
903910
gap: 4px;
904911
padding: 6px 12px;
905912
background: #2a2a2a;
@@ -2068,18 +2075,24 @@ html.mobile-init .file-browser-panel {
20682075
padding: 6px 8px;
20692076
gap: 8px;
20702077
align-items: center;
2071-
justify-content: center;
2078+
overflow-x: auto;
2079+
-webkit-overflow-scrolling: touch;
20722080
z-index: 51;
20732081
}
20742082

20752083
.keyboard-accessory-bar.visible {
20762084
display: flex;
20772085
}
20782086

2087+
.keyboard-accessory-bar::-webkit-scrollbar {
2088+
display: none;
2089+
}
2090+
20792091
.accessory-btn {
20802092
display: inline-flex;
20812093
align-items: center;
20822094
justify-content: center;
2095+
flex-shrink: 0;
20832096
gap: 4px;
20842097
padding: 6px 12px;
20852098
background: #2a2a2a;

0 commit comments

Comments
 (0)