Skip to content

Commit 8dc70a5

Browse files
author
Teigen
committed
fix(mobile): restore /compact button to keyboard accessory bar
Reverts eb83148 which removed the /compact button from both simple and extended accessory bar modes. Restores double-tap confirmation and refocus guard for the compact action.
1 parent 4d12908 commit 8dc70a5

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

src/web/public/keyboard-accessory.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
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, paste, Esc, and dismiss.
7+
* keyboard on mobile: arrow up/down, /init, /clear, /compact, paste, Esc, and dismiss.
88
* The paste button opens a dialog that handles both text paste and image attach
99
* (native picker + best-effort image paste, routed through app._uploadAndInsertImages).
10-
* Destructive actions (/clear) require double-tap confirmation (2s amber state).
10+
* Destructive actions (/clear, /compact) require double-tap confirmation (2s amber state).
1111
* Commands are sent as text + Enter separately for Ink compatibility.
1212
* Only initializes on touch devices (MobileDetection.isTouchDevice guard).
1313
*
@@ -58,6 +58,7 @@ const KeyboardAccessoryBar = {
5858
</svg>
5959
</button>
6060
<button class="accessory-btn" data-action="esc" title="Escape">Esc</button>
61+
<button class="accessory-btn" data-action="compact" title="/compact">/compact</button>
6162
<button class="accessory-btn accessory-btn-dismiss" data-action="dismiss" title="Dismiss keyboard">
6263
<svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3">
6364
<path d="M19 9l-7 7-7-7"/>
@@ -100,6 +101,7 @@ const KeyboardAccessoryBar = {
100101
<button class="accessory-btn" data-action="esc" title="Escape">Esc</button>
101102
<button class="accessory-btn" data-action="init" title="/init">/init</button>
102103
<button class="accessory-btn" data-action="clear" title="/clear">/clear</button>
104+
<button class="accessory-btn" data-action="compact" title="/compact">/compact</button>
103105
<button class="accessory-btn accessory-btn-dismiss" data-action="dismiss" title="Dismiss keyboard">
104106
<svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3">
105107
<path d="M19 9l-7 7-7-7"/>
@@ -129,7 +131,7 @@ const KeyboardAccessoryBar = {
129131
// Refocus terminal so keyboard stays open (tap blurs terminal → keyboard dismisses → toolbar shifts)
130132
const refocusActions = new Set(['scroll-up', 'scroll-down', 'arrow-left', 'arrow-right', 'tab', 'shift-tab', 'ctrl-o', 'opt-enter', 'esc', 'effort-max']);
131133
if (refocusActions.has(action) ||
132-
(action === 'clear' && this._confirmAction)) {
134+
((action === 'clear' || action === 'compact') && this._confirmAction)) {
133135
if (typeof app !== 'undefined' && app.terminal) {
134136
app.terminal.focus();
135137
}
@@ -192,11 +194,12 @@ const KeyboardAccessoryBar = {
192194
case 'init':
193195
this.sendCommand('/init');
194196
break;
195-
case 'clear': {
196-
// Require double-tap: first tap turns amber, second tap within 2s sends
197+
case 'clear':
198+
case 'compact': {
199+
const cmd = action === 'clear' ? '/clear' : '/compact';
197200
if (this._confirmAction === action && this._confirmTimer) {
198201
this.clearConfirm();
199-
this.sendCommand('/clear');
202+
this.sendCommand(cmd);
200203
} else {
201204
this.setConfirm(action, btn);
202205
}

0 commit comments

Comments
 (0)