@agi-fans/dsh-tui 0.21.0 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/CHANGELOG.md +158 -1
- package/lib/chrome/box.d.ts +47 -16
- package/lib/chrome/box.js +172 -130
- package/lib/chrome/box.js.map +1 -1
- package/lib/chrome/code-highlight.d.ts +15 -0
- package/lib/chrome/code-highlight.js +60 -4
- package/lib/chrome/code-highlight.js.map +1 -1
- package/lib/chrome/command-output.d.ts +29 -2
- package/lib/chrome/command-output.js +100 -4
- package/lib/chrome/command-output.js.map +1 -1
- package/lib/chrome/main-screen-renderer.d.ts +16 -0
- package/lib/chrome/main-screen-renderer.js +53 -5
- package/lib/chrome/main-screen-renderer.js.map +1 -1
- package/lib/chrome/markdown.js +30 -10
- package/lib/chrome/markdown.js.map +1 -1
- package/lib/chrome/relative-time.d.ts +17 -0
- package/lib/chrome/relative-time.js +36 -0
- package/lib/chrome/relative-time.js.map +1 -1
- package/lib/chrome/secret-mask.d.ts +35 -0
- package/lib/chrome/secret-mask.js +180 -0
- package/lib/chrome/secret-mask.js.map +1 -0
- package/lib/chrome/status-config.d.ts +161 -51
- package/lib/chrome/status-config.js +237 -126
- package/lib/chrome/status-config.js.map +1 -1
- package/lib/chrome/status-line.d.ts +3 -2
- package/lib/chrome/status-line.js +105 -63
- package/lib/chrome/status-line.js.map +1 -1
- package/lib/chrome/terminal-colors.d.ts +85 -0
- package/lib/chrome/terminal-colors.js +230 -0
- package/lib/chrome/terminal-colors.js.map +1 -0
- package/lib/chrome/terminal-images.d.ts +9 -1
- package/lib/chrome/terminal-images.js +27 -4
- package/lib/chrome/terminal-images.js.map +1 -1
- package/lib/chrome/theme.d.ts +32 -9
- package/lib/chrome/theme.js +595 -498
- package/lib/chrome/theme.js.map +1 -1
- package/lib/chrome/tool-renderers.js +69 -13
- package/lib/chrome/tool-renderers.js.map +1 -1
- package/lib/chrome/tools-list.d.ts +1 -4
- package/lib/chrome/tools-list.js +1 -41
- package/lib/chrome/tools-list.js.map +1 -1
- package/lib/chrome/welcome-tips.d.ts +20 -8
- package/lib/chrome/welcome-tips.js +22 -42
- package/lib/chrome/welcome-tips.js.map +1 -1
- package/lib/commands/auth-ids.d.ts +25 -0
- package/lib/commands/auth-ids.js +27 -0
- package/lib/commands/auth-ids.js.map +1 -0
- package/lib/commands/auth-input.d.ts +34 -0
- package/lib/commands/auth-input.js +96 -0
- package/lib/commands/auth-input.js.map +1 -0
- package/lib/commands/auth-providers.d.ts +39 -0
- package/lib/commands/auth-providers.js +125 -0
- package/lib/commands/auth-providers.js.map +1 -0
- package/lib/commands/auth.d.ts +12 -20
- package/lib/commands/auth.js +42 -229
- package/lib/commands/auth.js.map +1 -1
- package/lib/commands/btw.d.ts +13 -1
- package/lib/commands/btw.js +37 -104
- package/lib/commands/btw.js.map +1 -1
- package/lib/commands/diff.js +1 -96
- package/lib/commands/diff.js.map +1 -1
- package/lib/commands/export.d.ts +1 -1
- package/lib/commands/export.js +3 -27
- package/lib/commands/export.js.map +1 -1
- package/lib/commands/files.d.ts +17 -1
- package/lib/commands/files.js +67 -107
- package/lib/commands/files.js.map +1 -1
- package/lib/commands/jobs.d.ts +19 -4
- package/lib/commands/jobs.js +50 -7
- package/lib/commands/jobs.js.map +1 -1
- package/lib/commands/model.js +108 -76
- package/lib/commands/model.js.map +1 -1
- package/lib/commands/permission.js +15 -16
- package/lib/commands/permission.js.map +1 -1
- package/lib/commands/plugins.js +133 -16
- package/lib/commands/plugins.js.map +1 -1
- package/lib/commands/schedule.d.ts +10 -0
- package/lib/commands/schedule.js +45 -14
- package/lib/commands/schedule.js.map +1 -1
- package/lib/commands/session-configuration.js +2 -10
- package/lib/commands/session-configuration.js.map +1 -1
- package/lib/commands/session.js +14 -38
- package/lib/commands/session.js.map +1 -1
- package/lib/commands/terminal.d.ts +14 -8
- package/lib/commands/terminal.js +19 -178
- package/lib/commands/terminal.js.map +1 -1
- package/lib/commands/trajectory.js +4 -1
- package/lib/commands/trajectory.js.map +1 -1
- package/lib/definition.d.ts +122 -22
- package/lib/definition.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/input/actions.d.ts +51 -0
- package/lib/input/actions.js +120 -0
- package/lib/input/actions.js.map +1 -0
- package/lib/input/editor.d.ts +0 -10
- package/lib/input/editor.js +11 -9
- package/lib/input/editor.js.map +1 -1
- package/lib/input/image-paste.d.ts +19 -1
- package/lib/input/image-paste.js +82 -1
- package/lib/input/image-paste.js.map +1 -1
- package/lib/input/keybindings-config.d.ts +12 -5
- package/lib/input/keybindings-config.js +30 -57
- package/lib/input/keybindings-config.js.map +1 -1
- package/lib/input/keys.d.ts +16 -0
- package/lib/input/keys.js +38 -3
- package/lib/input/keys.js.map +1 -1
- package/lib/input/wheel-scroll.d.ts +46 -0
- package/lib/input/wheel-scroll.js +69 -0
- package/lib/input/wheel-scroll.js.map +1 -0
- package/lib/prompt-intents.d.ts +182 -0
- package/lib/prompt-intents.js +127 -0
- package/lib/prompt-intents.js.map +1 -0
- package/lib/runtime/cancellable.d.ts +75 -0
- package/lib/runtime/cancellable.js +76 -0
- package/lib/runtime/cancellable.js.map +1 -0
- package/lib/runtime/composer-images.js +5 -4
- package/lib/runtime/composer-images.js.map +1 -1
- package/lib/runtime/composer-shell.d.ts +17 -2
- package/lib/runtime/composer-shell.js +109 -43
- package/lib/runtime/composer-shell.js.map +1 -1
- package/lib/runtime/file-recovery-review.d.ts +0 -1
- package/lib/runtime/file-recovery-review.js +29 -30
- package/lib/runtime/file-recovery-review.js.map +1 -1
- package/lib/runtime/file-recovery-store.js +5 -1
- package/lib/runtime/file-recovery-store.js.map +1 -1
- package/lib/runtime/file-review.js +1 -1
- package/lib/runtime/file-review.js.map +1 -1
- package/lib/runtime/hook-settings.d.ts +2 -2
- package/lib/runtime/plain-tui.d.ts +2 -0
- package/lib/runtime/plain-tui.js +7 -1
- package/lib/runtime/plain-tui.js.map +1 -1
- package/lib/runtime/plugin-settings.d.ts +1 -1
- package/lib/runtime/plugin-settings.js +10 -8
- package/lib/runtime/plugin-settings.js.map +1 -1
- package/lib/runtime/provider-local.d.ts +57 -15
- package/lib/runtime/provider-local.js +1112 -471
- package/lib/runtime/provider-local.js.map +1 -1
- package/lib/runtime/runner.js +5 -11
- package/lib/runtime/runner.js.map +1 -1
- package/lib/runtime/settings-preferences.js +1 -1
- package/lib/runtime/settings-preferences.js.map +1 -1
- package/lib/runtime/startup-notices.js +2 -0
- package/lib/runtime/startup-notices.js.map +1 -1
- package/lib/runtime/terminal-modes.d.ts +47 -0
- package/lib/runtime/terminal-modes.js +86 -0
- package/lib/runtime/terminal-modes.js.map +1 -0
- package/lib/runtime/terminal-notifications.d.ts +3 -5
- package/lib/runtime/terminal-notifications.js +4 -8
- package/lib/runtime/terminal-notifications.js.map +1 -1
- package/lib/runtime/terminal-probe.d.ts +36 -0
- package/lib/runtime/terminal-probe.js +37 -0
- package/lib/runtime/terminal-probe.js.map +1 -0
- package/lib/runtime/terminal-session.d.ts +57 -0
- package/lib/runtime/terminal-session.js +164 -0
- package/lib/runtime/terminal-session.js.map +1 -0
- package/lib/session/interaction-adapter.js +7 -8
- package/lib/session/interaction-adapter.js.map +1 -1
- package/lib/session/message-queue.js +1 -1
- package/lib/session/message-queue.js.map +1 -1
- package/lib/session/package-metadata.d.ts +8 -0
- package/lib/session/package-metadata.js +8 -0
- package/lib/session/package-metadata.js.map +1 -1
- package/lib/session/session-controller.d.ts +10 -11
- package/lib/session/session-controller.js +95 -13
- package/lib/session/session-controller.js.map +1 -1
- package/lib/session/session-tree.d.ts +2 -0
- package/lib/session/session-tree.js +2 -0
- package/lib/session/session-tree.js.map +1 -1
- package/lib/session/tui-settings.d.ts +40 -11
- package/lib/session/tui-settings.js +73 -34
- package/lib/session/tui-settings.js.map +1 -1
- package/lib/views/autocomplete.d.ts +18 -2
- package/lib/views/autocomplete.js +51 -38
- package/lib/views/autocomplete.js.map +1 -1
- package/lib/views/copy-targets.d.ts +12 -13
- package/lib/views/copy-targets.js +16 -46
- package/lib/views/copy-targets.js.map +1 -1
- package/lib/views/document-reader.js +18 -5
- package/lib/views/document-reader.js.map +1 -1
- package/lib/views/event-views.js +42 -6
- package/lib/views/event-views.js.map +1 -1
- package/lib/views/history-search.js +15 -21
- package/lib/views/history-search.js.map +1 -1
- package/lib/views/hotkeys.d.ts +7 -1
- package/lib/views/hotkeys.js +49 -25
- package/lib/views/hotkeys.js.map +1 -1
- package/lib/views/list-navigation.d.ts +62 -0
- package/lib/views/list-navigation.js +73 -0
- package/lib/views/list-navigation.js.map +1 -0
- package/lib/views/list-view.d.ts +99 -0
- package/lib/views/list-view.js +165 -0
- package/lib/views/list-view.js.map +1 -0
- package/lib/views/prompt-selector.d.ts +31 -3
- package/lib/views/prompt-selector.js +249 -125
- package/lib/views/prompt-selector.js.map +1 -1
- package/lib/views/session-files.d.ts +1 -2
- package/lib/views/session-files.js +1 -11
- package/lib/views/session-files.js.map +1 -1
- package/lib/views/settings-list.d.ts +10 -8
- package/lib/views/settings-list.js +116 -283
- package/lib/views/settings-list.js.map +1 -1
- package/lib/views/trajectory-timeline.d.ts +72 -0
- package/lib/views/trajectory-timeline.js +133 -0
- package/lib/views/trajectory-timeline.js.map +1 -0
- package/lib/views/trajectory.d.ts +15 -4
- package/lib/views/trajectory.js +557 -123
- package/lib/views/trajectory.js.map +1 -1
- package/lib/views/transcript-render.d.ts +95 -25
- package/lib/views/transcript-render.js +501 -167
- package/lib/views/transcript-render.js.map +1 -1
- package/lib/views/transcript-search.d.ts +39 -6
- package/lib/views/transcript-search.js +46 -11
- package/lib/views/transcript-search.js.map +1 -1
- package/lib/views/transcript-types.d.ts +63 -5
- package/lib/views/transcript-types.js +23 -11
- package/lib/views/transcript-types.js.map +1 -1
- package/package.json +67 -86
- package/lib/commands/advisor.d.ts +0 -15
- package/lib/commands/advisor.js +0 -200
- package/lib/commands/advisor.js.map +0 -1
- package/lib/commands/loop.d.ts +0 -52
- package/lib/commands/loop.js +0 -307
- package/lib/commands/loop.js.map +0 -1
- package/lib/commands/rate.d.ts +0 -33
- package/lib/commands/rate.js +0 -212
- package/lib/commands/rate.js.map +0 -1
- package/lib/commands/steer.d.ts +0 -5
- package/lib/commands/steer.js +0 -24
- package/lib/commands/steer.js.map +0 -1
- package/lib/commands/worktree.d.ts +0 -5
- package/lib/commands/worktree.js +0 -103
- package/lib/commands/worktree.js.map +0 -1
- package/lib/runtime/terminal-reader.d.ts +0 -11
- package/lib/runtime/terminal-reader.js +0 -87
- package/lib/runtime/terminal-reader.js.map +0 -1
- package/lib/views/agent-hub.d.ts +0 -32
- package/lib/views/agent-hub.js +0 -209
- package/lib/views/agent-hub.js.map +0 -1
- package/lib/views/copy-selector.d.ts +0 -54
- package/lib/views/copy-selector.js +0 -170
- package/lib/views/copy-selector.js.map +0 -1
|
@@ -5,14 +5,15 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { TERMINAL_TITLE_MODES, TERMINAL_STATE_MODES } from "../runtime/terminal-state.js";
|
|
7
7
|
import { STARTUP_CHANGELOG_MODES } from "../session/release-notes.js";
|
|
8
|
-
import {
|
|
8
|
+
import { STATUS_DENSITIES, STATUS_ITEM_IDS, isStatusItemId, resolveStatusBarConfig, statusBarDocument, statusItemVisible, toggleStatusItem, } from "../chrome/status-config.js";
|
|
9
9
|
import { renderStatusFooter } from "../chrome/status-line.js";
|
|
10
|
-
import { BOX,
|
|
11
|
-
import { padToWidth, truncateToWidth, visibleWidth,
|
|
12
|
-
import { MOTION_MODES } from "../session/tui-settings.js";
|
|
10
|
+
import { BOX, THEME_NAMES, isThemeName } from "../chrome/theme.js";
|
|
11
|
+
import { padToWidth, truncateToWidth, visibleWidth, wrapTextStable } from "../chrome/width.js";
|
|
12
|
+
import { MOTION_MODES, NOTIFICATION_MODES, resolveNotificationMode, } from "../session/tui-settings.js";
|
|
13
13
|
import { MATH_MODES } from "../chrome/math.js";
|
|
14
14
|
import { MERMAID_MODES } from "../chrome/mermaid.js";
|
|
15
|
-
import {
|
|
15
|
+
import { listNavigation } from "./list-navigation.js";
|
|
16
|
+
import { LIST_CURSOR_CELLS, renderListRowWithValue } from "./list-view.js";
|
|
16
17
|
import { FEATURE_TOGGLES } from "../session/feature-toggles.js";
|
|
17
18
|
import { rankSearchResults } from "../input/fuzzy-search.js";
|
|
18
19
|
import { moveGraphemeLeft } from "../chrome/grapheme.js";
|
|
@@ -25,46 +26,30 @@ const AGENT_LANGUAGE_LABELS = {
|
|
|
25
26
|
en: 'English',
|
|
26
27
|
};
|
|
27
28
|
const AGENT_LANGUAGE_IDS = Object.fromEntries(Object.entries(AGENT_LANGUAGE_LABELS).map(([id, label]) => [label, id]));
|
|
28
|
-
const STATUS_ITEM_CONTROLS = '
|
|
29
|
+
const STATUS_ITEM_CONTROLS = 'Space shows or hides it.';
|
|
29
30
|
const STATUS_ITEM_COPY = {
|
|
30
|
-
model: { label: 'Model', description: `Model name on the
|
|
31
|
+
model: { label: 'Model', description: `Model name on the first footer line. ${STATUS_ITEM_CONTROLS}`, sample: 'deepseek' },
|
|
31
32
|
effort: { label: 'Effort', description: `Reasoning effort on the first footer line. ${STATUS_ITEM_CONTROLS}`, sample: 'max' },
|
|
32
33
|
path: { label: 'Path', description: `Workspace path on the right of the first footer line. ${STATUS_ITEM_CONTROLS}`, sample: '~/project' },
|
|
33
|
-
git: { label: 'Git', description: `Git branch on the
|
|
34
|
-
session: { label: 'Session', description: `Folded session title on the first footer line. Off
|
|
35
|
-
context: { label: 'Context', description: `Context occupancy
|
|
36
|
-
cache: { label: 'Cache', description: `Prompt-cache hit rate. Cache-hit percentages stay on the success color. ${STATUS_ITEM_CONTROLS}`, sample: 'Cache 99%' },
|
|
37
|
-
tokens: { label: 'Tokens', description: `Input and output token counts. ${STATUS_ITEM_CONTROLS}`, sample: '5.9M in' },
|
|
38
|
-
speed: { label: 'Latency', description: `First-token latency and decode rate. ${STATUS_ITEM_CONTROLS}`, sample: 'TTFT 1.2s' },
|
|
39
|
-
durations: { label: 'Time', description: `LLM and tool duration. ${STATUS_ITEM_CONTROLS}`, sample: 'LLM 16m51s' },
|
|
40
|
-
counts: { label: 'Activity', description: `Turn and step counts. ${STATUS_ITEM_CONTROLS}`, sample: '3 turns' },
|
|
34
|
+
git: { label: 'Git', description: `Git branch on the first footer line. A dirty worktree stays warning. ${STATUS_ITEM_CONTROLS}`, sample: 'main *1' },
|
|
35
|
+
session: { label: 'Session', description: `Folded session title on the first footer line. Off at Standard and Minimal; the terminal window title shows it regardless. ${STATUS_ITEM_CONTROLS}`, sample: 'Fix the parser' },
|
|
36
|
+
context: { label: 'Context', description: `Context occupancy, on the left of the second line. Its representation follows the density. ${STATUS_ITEM_CONTROLS}`, sample: 'Ctx 1.6%' },
|
|
37
|
+
cache: { label: 'Cache', description: `Prompt-cache hit rate, beside occupancy on the left. Cache-hit percentages stay on the success color. ${STATUS_ITEM_CONTROLS}`, sample: 'Cache 99%' },
|
|
38
|
+
tokens: { label: 'Tokens', description: `Input and output token counts, on the right with the other cost figures. ${STATUS_ITEM_CONTROLS}`, sample: '5.9M in' },
|
|
39
|
+
speed: { label: 'Latency', description: `First-token latency and decode rate, on the right. ${STATUS_ITEM_CONTROLS}`, sample: 'TTFT 1.2s' },
|
|
40
|
+
durations: { label: 'Time', description: `LLM and tool duration, on the right. ${STATUS_ITEM_CONTROLS}`, sample: 'LLM 16m51s' },
|
|
41
|
+
counts: { label: 'Activity', description: `Turn and step counts, on the right. ${STATUS_ITEM_CONTROLS}`, sample: '3 turns' },
|
|
41
42
|
};
|
|
42
|
-
function itemSwatch(id, token) {
|
|
43
|
-
if (token !== 'default')
|
|
44
|
-
return token === 'label' ? 'customMessageLabel' : token;
|
|
45
|
-
if (id === 'effort')
|
|
46
|
-
return 'customMessageLabel';
|
|
47
|
-
if (id === 'git')
|
|
48
|
-
return 'warning';
|
|
49
|
-
if (id === 'path')
|
|
50
|
-
return 'muted';
|
|
51
|
-
return 'text';
|
|
52
|
-
}
|
|
53
|
-
function statusItemVisible(config, id) {
|
|
54
|
-
return isStatusMetaId(id) ? (config.meta ?? STATUS_META_IDS).includes(id) : config.groups.includes(id);
|
|
55
|
-
}
|
|
56
43
|
function statusItemRow(config, id) {
|
|
57
44
|
const visible = statusItemVisible(config, id);
|
|
58
|
-
const color = config.colors?.[id] ?? 'default';
|
|
59
45
|
const copy = STATUS_ITEM_COPY[id];
|
|
60
46
|
return {
|
|
61
47
|
id: `statusItem:${id}`,
|
|
62
|
-
label:
|
|
48
|
+
label: copy.label,
|
|
63
49
|
description: copy.description,
|
|
64
50
|
sample: visible ? copy.sample : 'hidden',
|
|
65
|
-
value:
|
|
66
|
-
values:
|
|
67
|
-
swatch: itemSwatch(id, color),
|
|
51
|
+
value: visible ? 'shown' : 'hidden',
|
|
52
|
+
values: ['shown', 'hidden'],
|
|
68
53
|
hidden: !visible,
|
|
69
54
|
};
|
|
70
55
|
}
|
|
@@ -105,6 +90,13 @@ function generalSettingItems(prefs, editors = [{ id: 'auto', label: 'Auto' }]) {
|
|
|
105
90
|
value: prefs.mermaidMode ?? 'auto',
|
|
106
91
|
values: MERMAID_MODES,
|
|
107
92
|
},
|
|
93
|
+
{
|
|
94
|
+
id: 'hideThinking',
|
|
95
|
+
label: 'Thinking in turns',
|
|
96
|
+
description: 'Shown keeps reasoning visible while a turn runs; Hidden collapses it to one line. Ctrl+T flips this for the session.',
|
|
97
|
+
value: prefs.hideThinking === true ? 'hidden' : 'shown',
|
|
98
|
+
values: ['shown', 'hidden'],
|
|
99
|
+
},
|
|
108
100
|
{
|
|
109
101
|
id: 'editor',
|
|
110
102
|
label: 'Editor',
|
|
@@ -137,14 +129,7 @@ function generalSettingItems(prefs, editors = [{ id: 'auto', label: 'Auto' }]) {
|
|
|
137
129
|
id: 'terminalTitle', label: 'Terminal title', description: 'Status and session, session only, status and workspace, or Off. Changes the terminal tab title.', value: prefs.terminalTitle ?? 'status', values: TERMINAL_TITLE_MODES,
|
|
138
130
|
},
|
|
139
131
|
{
|
|
140
|
-
id: 'terminalState', label: '
|
|
141
|
-
},
|
|
142
|
-
{
|
|
143
|
-
id: 'terminalProgress',
|
|
144
|
-
label: 'Terminal activity',
|
|
145
|
-
description: 'Busy/idle status in supported terminal tabs and taskbars',
|
|
146
|
-
value: prefs.terminalProgress === true ? 'on' : 'off',
|
|
147
|
-
values: COLOR_VALUES,
|
|
132
|
+
id: 'terminalState', label: 'Terminal status', description: 'Auto reports the root Agent lifecycle once the terminal answers an OSC 7501 capability query; On reports regardless; Off clears reports.', value: prefs.terminalState ?? 'auto', values: TERMINAL_STATE_MODES,
|
|
148
133
|
},
|
|
149
134
|
{
|
|
150
135
|
id: 'checkUpdates',
|
|
@@ -163,23 +148,9 @@ function generalSettingItems(prefs, editors = [{ id: 'auto', label: 'Auto' }]) {
|
|
|
163
148
|
{
|
|
164
149
|
id: 'notifications',
|
|
165
150
|
label: 'Notifications',
|
|
166
|
-
description: 'Notify when a turn finishes or input is required',
|
|
167
|
-
value: prefs.notifications
|
|
168
|
-
values:
|
|
169
|
-
},
|
|
170
|
-
{
|
|
171
|
-
id: 'notificationFocus',
|
|
172
|
-
label: 'Notify when',
|
|
173
|
-
description: 'Only notify while away from the terminal, or regardless of focus. Terminals without focus reports use the existing notification policy.',
|
|
174
|
-
value: prefs.notificationFocus ?? 'unfocused',
|
|
175
|
-
values: ['unfocused', 'always'],
|
|
176
|
-
},
|
|
177
|
-
{
|
|
178
|
-
id: 'notificationThreshold',
|
|
179
|
-
label: 'Long turn',
|
|
180
|
-
description: 'Minimum duration for long-running notifications',
|
|
181
|
-
value: prefs.notificationThreshold ?? '30s',
|
|
182
|
-
values: ['15s', '30s', '1m', '2m'],
|
|
151
|
+
description: 'Notify when a long turn finishes or input is required. Away also waits until the terminal loses focus; Always reports regardless of focus.',
|
|
152
|
+
value: resolveNotificationMode(prefs.notifications, prefs.notificationFocus),
|
|
153
|
+
values: NOTIFICATION_MODES,
|
|
183
154
|
},
|
|
184
155
|
];
|
|
185
156
|
}
|
|
@@ -200,28 +171,21 @@ function statusSettingItems(prefs) {
|
|
|
200
171
|
{
|
|
201
172
|
id: 'statusEnabled',
|
|
202
173
|
label: 'Telemetry',
|
|
203
|
-
description: 'Show session metrics
|
|
174
|
+
description: 'Show session metrics below the first footer line',
|
|
204
175
|
value: statusBar.enabled ? 'on' : 'off',
|
|
205
176
|
values: COLOR_VALUES,
|
|
206
177
|
},
|
|
207
178
|
{
|
|
208
|
-
id: '
|
|
209
|
-
label: '
|
|
210
|
-
description: '
|
|
211
|
-
value: statusBar.
|
|
212
|
-
values:
|
|
213
|
-
},
|
|
214
|
-
{
|
|
215
|
-
id: 'statusContextStyle',
|
|
216
|
-
label: 'Context style',
|
|
217
|
-
description: 'Percentage, a ten-cell bar, used/window tokens, or percentage with tokens',
|
|
218
|
-
value: statusBar.contextStyle,
|
|
219
|
-
values: STATUS_CONTEXT_STYLES,
|
|
179
|
+
id: 'statusDensity',
|
|
180
|
+
label: 'Density',
|
|
181
|
+
description: 'Minimal shows occupancy and cache; Standard adds latency; Verbose adds tokens on the same line and gives durations and activity a third, with long labels and the detailed context form',
|
|
182
|
+
value: statusBar.density,
|
|
183
|
+
values: STATUS_DENSITIES,
|
|
220
184
|
},
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
...
|
|
185
|
+
// Each part has one fixed place, so the rows below are a list of what
|
|
186
|
+
// appears rather than a layout to assemble: Space shows or hides, and
|
|
187
|
+
// nothing has to be dragged into a column.
|
|
188
|
+
...STATUS_ITEM_IDS.map(id => statusItemRow(statusBar, id)),
|
|
225
189
|
];
|
|
226
190
|
}
|
|
227
191
|
/**
|
|
@@ -244,60 +208,6 @@ export function tuiSettingItems(prefs, agent, features, plugins, editors, action
|
|
|
244
208
|
...(plugins === undefined ? {} : { plugins }), ...(editors === undefined ? {} : { editors }),
|
|
245
209
|
...(actions === undefined ? {} : { actions }) }).flatMap(group => group.items);
|
|
246
210
|
}
|
|
247
|
-
function showInOrder(visible, order, id) {
|
|
248
|
-
const next = visible.filter(item => item !== id);
|
|
249
|
-
const position = order.indexOf(id);
|
|
250
|
-
const insert = next.findIndex(item => order.indexOf(item) > position);
|
|
251
|
-
next.splice(insert < 0 ? next.length : insert, 0, id);
|
|
252
|
-
return next;
|
|
253
|
-
}
|
|
254
|
-
function updateStatusGroup(config, id, value) {
|
|
255
|
-
const groups = config.groups.filter(group => group !== id);
|
|
256
|
-
if (value === 'hidden' || value === 'off')
|
|
257
|
-
return { ...config, groups };
|
|
258
|
-
if (value === 'shown')
|
|
259
|
-
return { ...config, groups: showInOrder(groups, config.order ?? STATUS_GROUP_IDS, id) };
|
|
260
|
-
const position = Number.parseInt(value, 10);
|
|
261
|
-
if (!Number.isInteger(position) || position < 1 || position > STATUS_GROUP_IDS.length)
|
|
262
|
-
return config;
|
|
263
|
-
groups.splice(Math.min(position - 1, groups.length), 0, id);
|
|
264
|
-
return { ...config, groups };
|
|
265
|
-
}
|
|
266
|
-
function toggleStatusItem(config, id) {
|
|
267
|
-
if (isStatusMetaId(id)) {
|
|
268
|
-
const meta = config.meta ?? [...STATUS_META_IDS];
|
|
269
|
-
const hidden = !meta.includes(id);
|
|
270
|
-
return {
|
|
271
|
-
...config,
|
|
272
|
-
meta: hidden ? showInOrder(meta.filter(item => item !== id), config.metaOrder ?? STATUS_META_IDS, id) : meta.filter(item => item !== id),
|
|
273
|
-
};
|
|
274
|
-
}
|
|
275
|
-
return updateStatusGroup(config, id, statusItemVisible(config, id) ? 'hidden' : 'shown');
|
|
276
|
-
}
|
|
277
|
-
function reorderVisible(visible, order, moving, direction) {
|
|
278
|
-
const from = visible.indexOf(moving);
|
|
279
|
-
if (from < 0)
|
|
280
|
-
return { visible: [...visible], order: [...order] };
|
|
281
|
-
const to = Math.max(0, Math.min(visible.length - 1, from + direction));
|
|
282
|
-
const nextVisible = [...visible];
|
|
283
|
-
if (to !== from) {
|
|
284
|
-
nextVisible.splice(from, 1);
|
|
285
|
-
nextVisible.splice(to, 0, moving);
|
|
286
|
-
}
|
|
287
|
-
const visibleSet = new Set(nextVisible);
|
|
288
|
-
const nextOrder = [];
|
|
289
|
-
let visibleIndex = 0;
|
|
290
|
-
for (const item of order) {
|
|
291
|
-
if (visibleSet.has(item))
|
|
292
|
-
nextOrder.push(nextVisible[visibleIndex++]);
|
|
293
|
-
else
|
|
294
|
-
nextOrder.push(item);
|
|
295
|
-
}
|
|
296
|
-
for (const item of nextVisible)
|
|
297
|
-
if (!nextOrder.includes(item))
|
|
298
|
-
nextOrder.push(item);
|
|
299
|
-
return { visible: nextVisible, order: nextOrder };
|
|
300
|
-
}
|
|
301
211
|
/** Apply one cycled value back onto the prefs record. */
|
|
302
212
|
export function applySettingValue(prefs, id, value) {
|
|
303
213
|
if (id === 'theme' && isThemeName(value))
|
|
@@ -310,6 +220,8 @@ export function applySettingValue(prefs, id, value) {
|
|
|
310
220
|
return { ...prefs, mathMode: value };
|
|
311
221
|
if (id === 'mermaidMode' && MERMAID_MODES.includes(value))
|
|
312
222
|
return { ...prefs, mermaidMode: value };
|
|
223
|
+
if (id === 'hideThinking')
|
|
224
|
+
return { ...prefs, hideThinking: value === 'hidden' };
|
|
313
225
|
if (id === 'pasteProtection')
|
|
314
226
|
return { ...prefs, pasteProtection: value === 'on' };
|
|
315
227
|
if (id === 'copyOnSelect')
|
|
@@ -321,47 +233,49 @@ export function applySettingValue(prefs, id, value) {
|
|
|
321
233
|
return { ...prefs, terminalTitle: value };
|
|
322
234
|
if (id === 'terminalState' && TERMINAL_STATE_MODES.includes(value))
|
|
323
235
|
return { ...prefs, terminalState: value };
|
|
324
|
-
if (id === 'terminalProgress')
|
|
325
|
-
return { ...prefs, terminalProgress: value === 'on' };
|
|
326
236
|
if (id === 'checkUpdates')
|
|
327
237
|
return { ...prefs, checkUpdates: value === 'on' };
|
|
328
238
|
if (id === 'startupChangelog' && STARTUP_CHANGELOG_MODES.includes(value)) {
|
|
329
239
|
return { ...prefs, startupChangelog: value };
|
|
330
240
|
}
|
|
331
|
-
if (id === 'notifications' &&
|
|
241
|
+
if (id === 'notifications' && NOTIFICATION_MODES.includes(value)) {
|
|
332
242
|
return { ...prefs, notifications: value };
|
|
333
243
|
}
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
244
|
+
/**
|
|
245
|
+
* The status line is one document: a density, plus the parts hidden on top of
|
|
246
|
+
* it. Row identity decides which field moves — there is no per-item colour or
|
|
247
|
+
* column left to write, and `enabled` survives only as "telemetry off".
|
|
248
|
+
*/
|
|
249
|
+
const statusBar = storedStatusBar(prefs);
|
|
250
|
+
if (id === 'statusDensity' && STATUS_DENSITIES.includes(value)) {
|
|
251
|
+
return { ...prefs, statusBar: { ...statusBar, density: value } };
|
|
338
252
|
}
|
|
339
|
-
const statusBar = resolveStatusBarConfig(prefs.statusBar, prefs.statusPreset);
|
|
340
253
|
if (id === 'statusEnabled')
|
|
341
254
|
return { ...prefs, statusBar: { ...statusBar, enabled: value === 'on' } };
|
|
342
|
-
if (id === 'statusLabels' && STATUS_LABEL_STYLES.includes(value)) {
|
|
343
|
-
return { ...prefs, statusBar: { ...statusBar, labels: value } };
|
|
344
|
-
}
|
|
345
|
-
if (id === 'statusContextStyle' && STATUS_CONTEXT_STYLES.includes(value)) {
|
|
346
|
-
return { ...prefs, statusBar: { ...statusBar, contextStyle: value } };
|
|
347
|
-
}
|
|
348
255
|
if (id.startsWith('statusItem:')) {
|
|
349
256
|
const item = id.slice('statusItem:'.length);
|
|
350
|
-
if (isStatusItemId(item)
|
|
351
|
-
return
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
}
|
|
359
|
-
if (STATUS_GROUP_IDS.includes(item)) {
|
|
360
|
-
return { ...prefs, statusBar: updateStatusGroup(statusBar, item, value) };
|
|
361
|
-
}
|
|
257
|
+
if (!isStatusItemId(item))
|
|
258
|
+
return prefs;
|
|
259
|
+
if (value !== 'shown' && value !== 'hidden' && value !== 'off')
|
|
260
|
+
return prefs;
|
|
261
|
+
const resolved = resolveStatusBarConfig(statusBar);
|
|
262
|
+
if (statusItemVisible(resolved, item) === (value === 'shown'))
|
|
263
|
+
return prefs;
|
|
264
|
+
return { ...prefs, statusBar: toggleStatusItem(statusBar, item) };
|
|
362
265
|
}
|
|
363
266
|
return prefs;
|
|
364
267
|
}
|
|
268
|
+
/**
|
|
269
|
+
* The document as it stands, ready for one edit.
|
|
270
|
+
*
|
|
271
|
+
* The narrowing is read from the *stored* document, not reconstructed from what
|
|
272
|
+
* the footer is showing. Reconstructing it turned every part the density happens
|
|
273
|
+
* to omit into an explicit hiding: pressing Space on one row then silently made
|
|
274
|
+
* a different density show less, which is the drift this replaced.
|
|
275
|
+
*/
|
|
276
|
+
function storedStatusBar(prefs) {
|
|
277
|
+
return statusBarDocument(resolveStatusBarConfig(prefs.statusBar, prefs.statusPreset));
|
|
278
|
+
}
|
|
365
279
|
function adjacentValue(current, values, direction) {
|
|
366
280
|
const index = values.indexOf(current);
|
|
367
281
|
return values[(index + direction + values.length) % values.length] ?? values[0] ?? current;
|
|
@@ -387,63 +301,6 @@ function selectedStatusItem(state) {
|
|
|
387
301
|
const item = id.slice('statusItem:'.length);
|
|
388
302
|
return isStatusItemId(item) ? item : undefined;
|
|
389
303
|
}
|
|
390
|
-
function startMoving(state, item) {
|
|
391
|
-
const config = resolveStatusBarConfig(state.prefs.statusBar, state.prefs.statusPreset);
|
|
392
|
-
const prefs = statusItemVisible(config, item)
|
|
393
|
-
? state.prefs
|
|
394
|
-
: { ...state.prefs, statusBar: toggleStatusItem(config, item) };
|
|
395
|
-
const selected = tuiSettingItems(prefs, state.agent, state.features, state.plugins, state.editors, state.actions).findIndex(row => row.id === `statusItem:${item}`);
|
|
396
|
-
return { ...state, prefs, selected: Math.max(0, selected), moving: item };
|
|
397
|
-
}
|
|
398
|
-
function assignItemSide(config, id, side) {
|
|
399
|
-
if (itemSide(config, id) === side)
|
|
400
|
-
return config;
|
|
401
|
-
const next = { ...config, sides: { ...config.sides, [id]: side } };
|
|
402
|
-
if (isStatusMetaId(id)) {
|
|
403
|
-
const order = (next.metaOrder ?? STATUS_META_IDS).filter(item => item !== id);
|
|
404
|
-
let last = -1;
|
|
405
|
-
for (let index = 0; index < order.length; index += 1) {
|
|
406
|
-
if (itemSide(next, order[index]) === side)
|
|
407
|
-
last = index;
|
|
408
|
-
}
|
|
409
|
-
order.splice(last + 1, 0, id);
|
|
410
|
-
return { ...next, metaOrder: order };
|
|
411
|
-
}
|
|
412
|
-
const order = (next.order ?? STATUS_GROUP_IDS).filter(item => item !== id);
|
|
413
|
-
let last = -1;
|
|
414
|
-
for (let index = 0; index < order.length; index += 1) {
|
|
415
|
-
if (itemSide(next, order[index]) === side)
|
|
416
|
-
last = index;
|
|
417
|
-
}
|
|
418
|
-
order.splice(last + 1, 0, id);
|
|
419
|
-
return { ...next, order };
|
|
420
|
-
}
|
|
421
|
-
function moveStatusItem(state, direction) {
|
|
422
|
-
const moving = state.moving;
|
|
423
|
-
if (moving === undefined)
|
|
424
|
-
return state;
|
|
425
|
-
const config = resolveStatusBarConfig(state.prefs.statusBar, state.prefs.statusPreset);
|
|
426
|
-
const side = itemSide(config, moving);
|
|
427
|
-
if (isStatusMetaId(moving)) {
|
|
428
|
-
const reordered = reorderVisible(config.meta.filter(id => itemSide(config, id) === side), config.metaOrder, moving, direction);
|
|
429
|
-
const prefs = { ...state.prefs, statusBar: { ...config, meta: reordered.visible.concat(config.meta.filter(id => itemSide(config, id) !== side)), metaOrder: reordered.order } };
|
|
430
|
-
const selected = tuiSettingItems(prefs, state.agent, state.features, state.plugins, state.editors, state.actions).findIndex(row => row.id === `statusItem:${moving}`);
|
|
431
|
-
return { ...state, prefs, selected, moving };
|
|
432
|
-
}
|
|
433
|
-
const reordered = reorderVisible(config.groups.filter(id => itemSide(config, id) === side), config.order, moving, direction);
|
|
434
|
-
const prefs = { ...state.prefs, statusBar: { ...config, groups: reordered.visible.concat(config.groups.filter(id => itemSide(config, id) !== side)), order: reordered.order } };
|
|
435
|
-
const selected = tuiSettingItems(prefs, state.agent, state.features, state.plugins, state.editors, state.actions).findIndex(row => row.id === `statusItem:${moving}`);
|
|
436
|
-
return { ...state, prefs, selected, moving };
|
|
437
|
-
}
|
|
438
|
-
function moveStatusItemSide(state, side) {
|
|
439
|
-
const moving = state.moving;
|
|
440
|
-
if (moving === undefined)
|
|
441
|
-
return state;
|
|
442
|
-
const config = resolveStatusBarConfig(state.prefs.statusBar, state.prefs.statusPreset);
|
|
443
|
-
const prefs = { ...state.prefs, statusBar: assignItemSide(config, moving, side) };
|
|
444
|
-
const selected = tuiSettingItems(prefs, state.agent, state.features, state.plugins, state.editors, state.actions).findIndex(row => row.id === `statusItem:${moving}`);
|
|
445
|
-
return { ...state, prefs, selected, moving };
|
|
446
|
-
}
|
|
447
304
|
function settingGroups(state) {
|
|
448
305
|
const owned = (section) => (state.plugins ?? [])
|
|
449
306
|
.filter(entry => (entry.section ?? 'advanced') === section)
|
|
@@ -451,11 +308,10 @@ function settingGroups(state) {
|
|
|
451
308
|
values: entry.inline?.choices.map(choice => choice.label) ?? [], resettable: (entry.fields?.length ?? 0) > 0 }));
|
|
452
309
|
return [
|
|
453
310
|
{ id: 'general', label: 'Interface', items: [...generalSettingItems(state.prefs, state.editors).map(item => ({ ...item,
|
|
454
|
-
resettable: true, group: ['theme', 'colors', 'motion', 'mathMode', 'mermaidMode', '
|
|
311
|
+
resettable: true, group: ['theme', 'colors', 'motion', 'mathMode', 'mermaidMode', 'hideThinking', 'terminalTitle', 'terminalState'].includes(item.id) ? 'Appearance'
|
|
455
312
|
: ['editor', 'mouseInteraction', 'pasteProtection', 'copyOnSelect'].includes(item.id) ? 'Input'
|
|
456
313
|
: ['checkUpdates', 'startupChangelog'].includes(item.id) ? 'Startup' : 'Notifications',
|
|
457
|
-
description:
|
|
458
|
-
: item.id === 'notificationThreshold' && state.prefs.notifications !== 'long-running' ? 'Applies only to long-running notifications. ' : '') + item.description,
|
|
314
|
+
description: item.description,
|
|
459
315
|
})), ...(state.actions ?? []).filter(item => item.group === 'Input')].sort((a, b) => ['Appearance', 'Input', 'Notifications', 'Startup'].indexOf(a.group ?? '') - ['Appearance', 'Input', 'Notifications', 'Startup'].indexOf(b.group ?? '')) },
|
|
460
316
|
{ id: 'agent', label: 'Agent', items: [...(state.actions ?? []).filter(item => item.group !== 'Input'), ...agentSettingItems(state.agent).map(item => ({ ...item, resettable: true, description: `${item.description}. Saved in this profile; applies from the next turn.` })), ...owned('agent')] },
|
|
461
317
|
{ id: 'tools', label: 'Tools', items: [...(state.features === undefined ? [] : featureSettingItems(state.features)), ...owned('tools')] },
|
|
@@ -559,7 +415,7 @@ function cycleSelected(state, direction = 1) {
|
|
|
559
415
|
}
|
|
560
416
|
/** Apply one decoded event to the overlay. */
|
|
561
417
|
export function applySettingsEvent(state, event) {
|
|
562
|
-
|
|
418
|
+
{
|
|
563
419
|
if (event.type === 'text' && (state.search !== undefined || event.value !== ' ')) {
|
|
564
420
|
const origin = tuiSettingItems(state.prefs, state.agent, state.features, state.plugins, state.editors, state.actions)[state.selected]?.id;
|
|
565
421
|
const searching = state.search === undefined ? { ...state, search: '', ...(origin === undefined ? {} : { searchOrigin: origin }) } : state;
|
|
@@ -597,21 +453,6 @@ export function applySettingsEvent(state, event) {
|
|
|
597
453
|
if (selected?.id.startsWith('plugin:') && (event.type === 'key' || selected.values.length === 0))
|
|
598
454
|
return { kind: 'open-plugin', id: selected.id.slice('plugin:'.length) };
|
|
599
455
|
}
|
|
600
|
-
if (state.moving !== undefined) {
|
|
601
|
-
if (event.type !== 'key')
|
|
602
|
-
return { kind: 'ignore' };
|
|
603
|
-
if (event.id === 'up' || event.id === 'down') {
|
|
604
|
-
return { kind: 'apply', domain: 'tui', state: moveStatusItem(state, event.id === 'up' ? -1 : 1) };
|
|
605
|
-
}
|
|
606
|
-
if (event.id === 'left' || event.id === 'right') {
|
|
607
|
-
return { kind: 'apply', domain: 'tui', state: moveStatusItemSide(state, event.id === 'left' ? 'left' : 'right') };
|
|
608
|
-
}
|
|
609
|
-
if (event.id === 'enter' || event.id === 'escape' || event.id === 'ctrl+c') {
|
|
610
|
-
const { moving: _, ...rest } = state;
|
|
611
|
-
return { kind: 'update', state: rest };
|
|
612
|
-
}
|
|
613
|
-
return { kind: 'ignore' };
|
|
614
|
-
}
|
|
615
456
|
if (event.type === 'text' && event.value === ' ') {
|
|
616
457
|
const item = selectedStatusItem(state);
|
|
617
458
|
if (item === undefined)
|
|
@@ -621,10 +462,7 @@ export function applySettingsEvent(state, event) {
|
|
|
621
462
|
domain: 'tui',
|
|
622
463
|
state: {
|
|
623
464
|
...state,
|
|
624
|
-
prefs: {
|
|
625
|
-
...state.prefs,
|
|
626
|
-
statusBar: toggleStatusItem(resolveStatusBarConfig(state.prefs.statusBar, state.prefs.statusPreset), item),
|
|
627
|
-
},
|
|
465
|
+
prefs: { ...state.prefs, statusBar: toggleStatusItem(storedStatusBar(state.prefs), item) },
|
|
628
466
|
},
|
|
629
467
|
};
|
|
630
468
|
}
|
|
@@ -632,35 +470,31 @@ export function applySettingsEvent(state, event) {
|
|
|
632
470
|
return { kind: 'ignore' };
|
|
633
471
|
switch (event.id) {
|
|
634
472
|
case 'enter':
|
|
635
|
-
{
|
|
636
|
-
const item = selectedStatusItem(state);
|
|
637
|
-
if (item !== undefined) {
|
|
638
|
-
const { search: _, searchOrigin: __, ...browse } = state;
|
|
639
|
-
return { kind: 'apply', domain: 'tui', state: startMoving(browse, item) };
|
|
640
|
-
}
|
|
641
|
-
}
|
|
642
473
|
return cycleSelected(state);
|
|
643
474
|
case 'right':
|
|
644
475
|
return cycleSelected(state);
|
|
645
476
|
case 'left':
|
|
646
477
|
return cycleSelected(state, -1);
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
return { kind: 'update', state: moveSelected(state, state.selected - 1) };
|
|
652
|
-
case 'down':
|
|
653
|
-
return { kind: 'update', state: moveSelected(state, state.selected + 1) };
|
|
478
|
+
// This overlay keeps three keys that a plain list would spend on movement:
|
|
479
|
+
// `tab` switches section, and `home`/`end` jump to the edge of the current
|
|
480
|
+
// section rather than of the whole list, which is the only reading that makes
|
|
481
|
+
// sense when the rows above belong to another category.
|
|
654
482
|
case 'tab':
|
|
655
483
|
return { kind: 'update', state: moveSection(state, 1) };
|
|
656
484
|
case 'shift+tab':
|
|
657
485
|
return { kind: 'update', state: moveSection(state, -1) };
|
|
658
486
|
case 'home':
|
|
659
|
-
return { kind: 'update', state: moveSelected(state,
|
|
487
|
+
return { kind: 'update', state: moveSelected(state, selectedSection(state).start) };
|
|
660
488
|
case 'end':
|
|
661
489
|
return { kind: 'update', state: moveSelected(state, selectedSection(state).end - 1) };
|
|
662
|
-
default:
|
|
490
|
+
default: {
|
|
491
|
+
const navigation = listNavigation(event);
|
|
492
|
+
if (navigation.kind === 'close')
|
|
493
|
+
return { kind: 'close' };
|
|
494
|
+
if (navigation.kind === 'move')
|
|
495
|
+
return { kind: 'update', state: moveSelected(state, state.selected + navigation.delta) };
|
|
663
496
|
return { kind: 'ignore' };
|
|
497
|
+
}
|
|
664
498
|
}
|
|
665
499
|
}
|
|
666
500
|
/** First overlay-local row that paints a setting item. */
|
|
@@ -670,14 +504,11 @@ export const SETTINGS_ITEM_ROW = 3;
|
|
|
670
504
|
const HOTKEY_NAVIGATE = { keys: '↑↓', action: 'Navigate rows' };
|
|
671
505
|
const HOTKEY_CHANGE = { keys: '←→', action: 'Change the selected value' };
|
|
672
506
|
const HOTKEY_TOGGLE = { keys: 'Space', action: 'Toggle — show or hide a status item, or cycle other rows' };
|
|
673
|
-
const HOTKEY_MOVE = { keys: 'Enter', action: 'Change —
|
|
507
|
+
const HOTKEY_MOVE = { keys: 'Enter', action: 'Change — open configuration, or cycle other rows' };
|
|
674
508
|
const HOTKEY_SECTION = { keys: 'Tab / Shift+Tab', action: 'Switch section' };
|
|
675
509
|
const HOTKEY_EDGE = { keys: 'Home / End', action: 'Jump to the section edges' };
|
|
676
510
|
const HOTKEY_CLOSE = { keys: 'Esc', action: 'Clear search, return to browsing, or close the overlay' };
|
|
677
|
-
const HOTKEY_CANCEL = { keys: 'Ctrl+C', action: 'Close the overlay
|
|
678
|
-
const HOTKEY_ORDER = { keys: '↑↓', action: 'Order the grabbed item while moving' };
|
|
679
|
-
const HOTKEY_COLUMN = { keys: '←→', action: 'Column — choose the footer side while moving' };
|
|
680
|
-
const HOTKEY_PLACE = { keys: 'Enter / Esc', action: 'Place the grabbed item and stop moving' };
|
|
511
|
+
const HOTKEY_CANCEL = { keys: 'Ctrl+C', action: 'Close the overlay' };
|
|
681
512
|
/** Keys the settings overlay accepts; `/help` and its bottom hint read this list. */
|
|
682
513
|
export const SETTINGS_HOTKEYS = [
|
|
683
514
|
HOTKEY_NAVIGATE,
|
|
@@ -688,18 +519,13 @@ export const SETTINGS_HOTKEYS = [
|
|
|
688
519
|
HOTKEY_EDGE,
|
|
689
520
|
{ keys: '/ or Text', action: 'Search across all categories' },
|
|
690
521
|
{ keys: 'Backspace / Ctrl+U', action: 'Edit or clear the settings search' },
|
|
691
|
-
{ keys: 'Ctrl+R', action: 'Restore inheritance for the selected setting
|
|
522
|
+
{ keys: 'Ctrl+R', action: 'Restore inheritance for the selected setting' },
|
|
692
523
|
HOTKEY_CLOSE,
|
|
693
524
|
HOTKEY_CANCEL,
|
|
694
|
-
HOTKEY_ORDER,
|
|
695
|
-
HOTKEY_COLUMN,
|
|
696
|
-
HOTKEY_PLACE,
|
|
697
525
|
];
|
|
698
526
|
/** Bottom hint for the overlay; the grabbed-row state swaps in its own gestures. */
|
|
699
|
-
function settingsHints(
|
|
700
|
-
return
|
|
701
|
-
? formatOverlayHint([HOTKEY_ORDER, HOTKEY_COLUMN, HOTKEY_PLACE])
|
|
702
|
-
: '↑↓ select · ←→ change · Tab sections · / search · Ctrl+R reset · Esc back';
|
|
527
|
+
function settingsHints() {
|
|
528
|
+
return '↑↓ select · ←→ change · Tab sections · / search · Ctrl+R reset · Esc back';
|
|
703
529
|
}
|
|
704
530
|
function fit(text, width) {
|
|
705
531
|
if (width <= 0)
|
|
@@ -831,11 +657,11 @@ export function renderSettings(state, theme, width, height = 24) {
|
|
|
831
657
|
cursorRow = lines.length;
|
|
832
658
|
const above = start > 0 && row === 0 ? theme.fg('dim', '↑ ') : '';
|
|
833
659
|
const below = start + visibleCount < rows.length && row === viewportHeight - 1 ? theme.fg('dim', '↓ ') : '';
|
|
834
|
-
lines.push(framedRow(theme, renderSettingRow(entry.section === undefined ? item : { ...item, label: `${item.label} · ${entry.section}` }, selectedRow, theme, Math.max(1, width - 4), above || below,
|
|
660
|
+
lines.push(framedRow(theme, renderSettingRow(entry.section === undefined ? item : { ...item, label: `${item.label} · ${entry.section}` }, selectedRow, theme, Math.max(1, width - 4), above || below, false), width));
|
|
835
661
|
}
|
|
836
662
|
lines.push(divider(theme, width));
|
|
837
663
|
const description = selected === undefined ? '' : selected.description;
|
|
838
|
-
const descriptionLines =
|
|
664
|
+
const descriptionLines = wrapTextStable(description, Math.max(1, width - 8)).slice(0, descriptionRows);
|
|
839
665
|
for (let row = 0; row < descriptionRows; row += 1) {
|
|
840
666
|
const text = descriptionLines[row] ?? '';
|
|
841
667
|
lines.push(framedRow(theme, text === '' ? '' : ' ' + theme.fg('muted', text), width));
|
|
@@ -843,10 +669,10 @@ export function renderSettings(state, theme, width, height = 24) {
|
|
|
843
669
|
const fullHint = matches !== undefined ? 'Type filter · ↑↓ select · ←→ change · Enter edit · Tab sections · Esc clear/back'
|
|
844
670
|
: selected?.action !== undefined ? 'Enter open · Tab sections · / search · Esc back'
|
|
845
671
|
: selected?.id.startsWith('plugin:') === true ? `Enter configure${selected.values.length > 0 ? ' · ←→ change' : ''} · Tab sections · / search${selected.resettable ? ' · Ctrl+R reset' : ''} · Esc back`
|
|
846
|
-
: selected?.id.startsWith('statusItem:') === true
|
|
847
|
-
? 'Space show/hide ·
|
|
848
|
-
: selected?.resettable === false ? '←→ change · Tab sections · / search · Esc back' : settingsHints(
|
|
849
|
-
const hints = theme.fg('dim', width < 60
|
|
672
|
+
: selected?.id.startsWith('statusItem:') === true
|
|
673
|
+
? 'Space show/hide · / search · Esc back'
|
|
674
|
+
: selected?.resettable === false ? '←→ change · Tab sections · / search · Esc back' : settingsHints();
|
|
675
|
+
const hints = theme.fg('dim', width < 60
|
|
850
676
|
? matches !== undefined ? 'Type filter · ↑↓ · Esc clear/back' : 'Tab sections · / search · Esc back'
|
|
851
677
|
: fullHint);
|
|
852
678
|
lines.push(framedRow(theme, hints, width), bottomBorder(theme, width));
|
|
@@ -856,18 +682,25 @@ export function renderSettings(state, theme, width, height = 24) {
|
|
|
856
682
|
};
|
|
857
683
|
}
|
|
858
684
|
function renderSettingRow(item, selected, theme, width, edge = '', moving = false) {
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
? theme.bold(theme.fg('accent', item.label))
|
|
862
|
-
: item.hidden === true ? theme.fg('dim', item.label) : item.label;
|
|
863
|
-
const sample = item.sample === undefined
|
|
864
|
-
? ''
|
|
865
|
-
: ' ' + theme.fg(item.hidden === true ? 'dim' : 'muted', item.sample);
|
|
685
|
+
// A colour value keeps its swatch tone only when the row is not selected;
|
|
686
|
+
// selection has to win, or the reader cannot tell which row the cursor is on.
|
|
866
687
|
const rawValue = moving ? 'moving' : item.value;
|
|
867
|
-
const value = selected || item.swatch === undefined
|
|
868
|
-
|
|
869
|
-
:
|
|
870
|
-
|
|
871
|
-
|
|
688
|
+
const value = selected || item.swatch === undefined ? rawValue : theme.fg(item.swatch, rawValue);
|
|
689
|
+
const row = {
|
|
690
|
+
label: item.label,
|
|
691
|
+
...(item.sample === undefined ? {} : { description: item.sample }),
|
|
692
|
+
secondary: item.hidden === true,
|
|
693
|
+
value,
|
|
694
|
+
};
|
|
695
|
+
const rendered = renderListRowWithValue(row, theme, width, visibleWidth(item.label), {
|
|
696
|
+
selected,
|
|
697
|
+
...(moving ? { moving } : {}),
|
|
698
|
+
});
|
|
699
|
+
// An edge mark replaces the cursor cell, which the shared row already
|
|
700
|
+
// reserved, so the row cannot shift when the reader reaches either end.
|
|
701
|
+
if (edge === '')
|
|
702
|
+
return rendered;
|
|
703
|
+
const mark = theme.fg('dim', edge.trimStart() + ' ');
|
|
704
|
+
return truncateToWidth(mark + rendered.slice(LIST_CURSOR_CELLS), width);
|
|
872
705
|
}
|
|
873
706
|
//# sourceMappingURL=settings-list.js.map
|