|
4 | 4 | * Defines two exports: |
5 | 5 | * |
6 | 6 | * - 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. |
8 | 8 | * The paste button opens a dialog that handles both text paste and image attach |
9 | 9 | * (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). |
11 | 11 | * Commands are sent as text + Enter separately for Ink compatibility. |
12 | 12 | * Only initializes on touch devices (MobileDetection.isTouchDevice guard). |
13 | 13 | * |
@@ -58,6 +58,7 @@ const KeyboardAccessoryBar = { |
58 | 58 | </svg> |
59 | 59 | </button> |
60 | 60 | <button class="accessory-btn" data-action="esc" title="Escape">Esc</button> |
| 61 | + <button class="accessory-btn" data-action="compact" title="/compact">/compact</button> |
61 | 62 | <button class="accessory-btn accessory-btn-dismiss" data-action="dismiss" title="Dismiss keyboard"> |
62 | 63 | <svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3"> |
63 | 64 | <path d="M19 9l-7 7-7-7"/> |
@@ -100,6 +101,7 @@ const KeyboardAccessoryBar = { |
100 | 101 | <button class="accessory-btn" data-action="esc" title="Escape">Esc</button> |
101 | 102 | <button class="accessory-btn" data-action="init" title="/init">/init</button> |
102 | 103 | <button class="accessory-btn" data-action="clear" title="/clear">/clear</button> |
| 104 | + <button class="accessory-btn" data-action="compact" title="/compact">/compact</button> |
103 | 105 | <button class="accessory-btn accessory-btn-dismiss" data-action="dismiss" title="Dismiss keyboard"> |
104 | 106 | <svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3"> |
105 | 107 | <path d="M19 9l-7 7-7-7"/> |
@@ -129,7 +131,7 @@ const KeyboardAccessoryBar = { |
129 | 131 | // Refocus terminal so keyboard stays open (tap blurs terminal → keyboard dismisses → toolbar shifts) |
130 | 132 | const refocusActions = new Set(['scroll-up', 'scroll-down', 'arrow-left', 'arrow-right', 'tab', 'shift-tab', 'ctrl-o', 'opt-enter', 'esc', 'effort-max']); |
131 | 133 | if (refocusActions.has(action) || |
132 | | - (action === 'clear' && this._confirmAction)) { |
| 134 | + ((action === 'clear' || action === 'compact') && this._confirmAction)) { |
133 | 135 | if (typeof app !== 'undefined' && app.terminal) { |
134 | 136 | app.terminal.focus(); |
135 | 137 | } |
@@ -192,11 +194,12 @@ const KeyboardAccessoryBar = { |
192 | 194 | case 'init': |
193 | 195 | this.sendCommand('/init'); |
194 | 196 | 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'; |
197 | 200 | if (this._confirmAction === action && this._confirmTimer) { |
198 | 201 | this.clearConfirm(); |
199 | | - this.sendCommand('/clear'); |
| 202 | + this.sendCommand(cmd); |
200 | 203 | } else { |
201 | 204 | this.setConfirm(action, btn); |
202 | 205 | } |
|
0 commit comments