@agi-fans/dsh-tui 0.1.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/LICENSE +21 -0
- package/README.md +13 -0
- package/lib/autocomplete.d.ts +80 -0
- package/lib/autocomplete.js +320 -0
- package/lib/autocomplete.js.map +1 -0
- package/lib/box.d.ts +79 -0
- package/lib/box.js +276 -0
- package/lib/box.js.map +1 -0
- package/lib/clipboard.d.ts +19 -0
- package/lib/clipboard.js +77 -0
- package/lib/clipboard.js.map +1 -0
- package/lib/command-integrations.d.ts +10 -0
- package/lib/command-integrations.js +49 -0
- package/lib/command-integrations.js.map +1 -0
- package/lib/command-mode.d.ts +5 -0
- package/lib/command-mode.js +73 -0
- package/lib/command-mode.js.map +1 -0
- package/lib/command-model.d.ts +5 -0
- package/lib/command-model.js +87 -0
- package/lib/command-model.js.map +1 -0
- package/lib/command-output.d.ts +6 -0
- package/lib/command-output.js +33 -0
- package/lib/command-output.js.map +1 -0
- package/lib/command-queue.d.ts +5 -0
- package/lib/command-queue.js +62 -0
- package/lib/command-queue.js.map +1 -0
- package/lib/command-registration.d.ts +5 -0
- package/lib/command-registration.js +20 -0
- package/lib/command-registration.js.map +1 -0
- package/lib/command-session.d.ts +5 -0
- package/lib/command-session.js +153 -0
- package/lib/command-session.js.map +1 -0
- package/lib/command-transcript.d.ts +5 -0
- package/lib/command-transcript.js +85 -0
- package/lib/command-transcript.js.map +1 -0
- package/lib/copy-selector.d.ts +52 -0
- package/lib/copy-selector.js +136 -0
- package/lib/copy-selector.js.map +1 -0
- package/lib/copy-targets.d.ts +34 -0
- package/lib/copy-targets.js +170 -0
- package/lib/copy-targets.js.map +1 -0
- package/lib/definition.d.ts +171 -0
- package/lib/definition.js +14 -0
- package/lib/definition.js.map +1 -0
- package/lib/editor.d.ts +66 -0
- package/lib/editor.js +365 -0
- package/lib/editor.js.map +1 -0
- package/lib/event-views.d.ts +188 -0
- package/lib/event-views.js +678 -0
- package/lib/event-views.js.map +1 -0
- package/lib/external-editor.d.ts +2 -0
- package/lib/external-editor.js +31 -0
- package/lib/external-editor.js.map +1 -0
- package/lib/history-search.d.ts +61 -0
- package/lib/history-search.js +239 -0
- package/lib/history-search.js.map +1 -0
- package/lib/history-store.d.ts +8 -0
- package/lib/history-store.js +36 -0
- package/lib/history-store.js.map +1 -0
- package/lib/hotkeys.d.ts +14 -0
- package/lib/hotkeys.js +115 -0
- package/lib/hotkeys.js.map +1 -0
- package/lib/human-interaction.d.ts +5 -0
- package/lib/human-interaction.js +8 -0
- package/lib/human-interaction.js.map +1 -0
- package/lib/image-paste.d.ts +21 -0
- package/lib/image-paste.js +277 -0
- package/lib/image-paste.js.map +1 -0
- package/lib/index.d.ts +10 -0
- package/lib/index.js +11 -0
- package/lib/index.js.map +1 -0
- package/lib/interaction-adapter.d.ts +18 -0
- package/lib/interaction-adapter.js +93 -0
- package/lib/interaction-adapter.js.map +1 -0
- package/lib/keybindings-config.d.ts +5 -0
- package/lib/keybindings-config.js +28 -0
- package/lib/keybindings-config.js.map +1 -0
- package/lib/keys.d.ts +59 -0
- package/lib/keys.js +263 -0
- package/lib/keys.js.map +1 -0
- package/lib/markdown.d.ts +13 -0
- package/lib/markdown.js +453 -0
- package/lib/markdown.js.map +1 -0
- package/lib/path-complete.d.ts +85 -0
- package/lib/path-complete.js +231 -0
- package/lib/path-complete.js.map +1 -0
- package/lib/path-mentions.d.ts +4 -0
- package/lib/path-mentions.js +50 -0
- package/lib/path-mentions.js.map +1 -0
- package/lib/project-context.d.ts +13 -0
- package/lib/project-context.js +52 -0
- package/lib/project-context.js.map +1 -0
- package/lib/project-file-search.d.ts +25 -0
- package/lib/project-file-search.js +207 -0
- package/lib/project-file-search.js.map +1 -0
- package/lib/prompt-selector.d.ts +56 -0
- package/lib/prompt-selector.js +297 -0
- package/lib/prompt-selector.js.map +1 -0
- package/lib/provider-local.d.ts +115 -0
- package/lib/provider-local.js +1760 -0
- package/lib/provider-local.js.map +1 -0
- package/lib/pwd.d.ts +13 -0
- package/lib/pwd.js +14 -0
- package/lib/pwd.js.map +1 -0
- package/lib/relative-time.d.ts +2 -0
- package/lib/relative-time.js +11 -0
- package/lib/relative-time.js.map +1 -0
- package/lib/renderer.d.ts +112 -0
- package/lib/renderer.js +181 -0
- package/lib/renderer.js.map +1 -0
- package/lib/runner.d.ts +9 -0
- package/lib/runner.js +94 -0
- package/lib/runner.js.map +1 -0
- package/lib/session-controller.d.ts +92 -0
- package/lib/session-controller.js +571 -0
- package/lib/session-controller.js.map +1 -0
- package/lib/session-runtime.d.ts +16 -0
- package/lib/session-runtime.js +17 -0
- package/lib/session-runtime.js.map +1 -0
- package/lib/settings-list.d.ts +67 -0
- package/lib/settings-list.js +380 -0
- package/lib/settings-list.js.map +1 -0
- package/lib/status-config.d.ts +32 -0
- package/lib/status-config.js +52 -0
- package/lib/status-config.js.map +1 -0
- package/lib/status-line.d.ts +41 -0
- package/lib/status-line.js +351 -0
- package/lib/status-line.js.map +1 -0
- package/lib/style.d.ts +22 -0
- package/lib/style.js +23 -0
- package/lib/style.js.map +1 -0
- package/lib/theme.d.ts +83 -0
- package/lib/theme.js +317 -0
- package/lib/theme.js.map +1 -0
- package/lib/tool-presentation.d.ts +20 -0
- package/lib/tool-presentation.js +79 -0
- package/lib/tool-presentation.js.map +1 -0
- package/lib/tool-renderers.d.ts +21 -0
- package/lib/tool-renderers.js +133 -0
- package/lib/tool-renderers.js.map +1 -0
- package/lib/tools-list.d.ts +14 -0
- package/lib/tools-list.js +61 -0
- package/lib/tools-list.js.map +1 -0
- package/lib/transcript-export.d.ts +4 -0
- package/lib/transcript-export.js +66 -0
- package/lib/transcript-export.js.map +1 -0
- package/lib/tui-settings.d.ts +20 -0
- package/lib/tui-settings.js +23 -0
- package/lib/tui-settings.js.map +1 -0
- package/lib/welcome-tips.d.ts +10 -0
- package/lib/welcome-tips.js +36 -0
- package/lib/welcome-tips.js.map +1 -0
- package/lib/width.d.ts +54 -0
- package/lib/width.js +323 -0
- package/lib/width.js.map +1 -0
- package/package.json +119 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `/tools` help body: names visible to the current agent.
|
|
3
|
+
* @module @agi-fans/dsh-tui
|
|
4
|
+
*/
|
|
5
|
+
import { renderMarkdown } from "./markdown.js";
|
|
6
|
+
import { truncateToWidth, visibleWidth } from "./width.js";
|
|
7
|
+
function tableCell(value) {
|
|
8
|
+
return value.replace(/\|/gu, '\\|').replace(/\s+/gu, ' ').trim();
|
|
9
|
+
}
|
|
10
|
+
/** Markdown table shown in the `/tools` transcript panel. */
|
|
11
|
+
export function formatToolsText(tools) {
|
|
12
|
+
if (tools.length === 0)
|
|
13
|
+
return 'No tools are currently visible to the agent.';
|
|
14
|
+
const lines = ['| Tool | Description |', '|---|---|'];
|
|
15
|
+
const sorted = [...tools].sort((left, right) => left.name < right.name ? -1 : 1);
|
|
16
|
+
for (const tool of sorted) {
|
|
17
|
+
const name = tableCell(tool.name);
|
|
18
|
+
const description = tableCell(tool.description) || 'No description provided.';
|
|
19
|
+
lines.push(`| \`${name}\` | ${description} |`);
|
|
20
|
+
}
|
|
21
|
+
return lines.join('\n');
|
|
22
|
+
}
|
|
23
|
+
function cleanDescription(value) {
|
|
24
|
+
return value.replace(/\s+/gu, ' ').trim() || 'No description provided.';
|
|
25
|
+
}
|
|
26
|
+
function compactCatalog(tools, contentWidth) {
|
|
27
|
+
const nameWidth = Math.min(30, Math.max(visibleWidth('Tool'), ...tools.map(tool => visibleWidth(tool.name))));
|
|
28
|
+
const descriptionWidth = Math.max(1, contentWidth - 7 - nameWidth);
|
|
29
|
+
let shortened = false;
|
|
30
|
+
const compact = tools.map(tool => {
|
|
31
|
+
const description = cleanDescription(tool.description);
|
|
32
|
+
if (visibleWidth(description) <= descriptionWidth)
|
|
33
|
+
return { ...tool, description };
|
|
34
|
+
shortened = true;
|
|
35
|
+
return {
|
|
36
|
+
...tool,
|
|
37
|
+
description: truncateToWidth(description, descriptionWidth).replace(/\x1b\[0m$/u, ''),
|
|
38
|
+
};
|
|
39
|
+
});
|
|
40
|
+
return { tools: compact, shortened };
|
|
41
|
+
}
|
|
42
|
+
/** OMP-style command heading followed by the native Markdown table. */
|
|
43
|
+
export function renderToolsPanel(tools, theme, width, expanded = false) {
|
|
44
|
+
const inset = width > 2 ? 1 : 0;
|
|
45
|
+
const contentWidth = Math.max(1, width - inset * 2);
|
|
46
|
+
const prefix = ' '.repeat(inset);
|
|
47
|
+
const title = theme.bold(theme.fg('accent', 'Available Tools'))
|
|
48
|
+
+ theme.fg('muted', ` · ${tools.length} active`);
|
|
49
|
+
const compact = compactCatalog(tools, contentWidth);
|
|
50
|
+
const shown = expanded ? tools : compact.tools;
|
|
51
|
+
const body = tools.length === 0
|
|
52
|
+
? [theme.fg('muted', 'No tools are currently visible to the agent.')]
|
|
53
|
+
: renderMarkdown(formatToolsText(shown), theme, contentWidth);
|
|
54
|
+
if (compact.shortened) {
|
|
55
|
+
body.push('', theme.fg('dim', expanded
|
|
56
|
+
? '⟨Ctrl+O: Collapse descriptions⟩'
|
|
57
|
+
: 'Descriptions shortened · ⟨Ctrl+O: Expand⟩'));
|
|
58
|
+
}
|
|
59
|
+
return [prefix + title, '', ...body.map(line => prefix + line)];
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=tools-list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools-list.js","sourceRoot":"","sources":["../src/tools-list.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAE9C,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAQ1D,SAAS,SAAS,CAAC,KAAa;IAC9B,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAA;AAClE,CAA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,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAA;IAC9C,MAAM,IAAI,GAAG,KAAK,CAAC,MAAM,KAAK,CAAC;QAC7B,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,8CAA8C,CAAC,CAAC;QACrE,CAAC,CAAC,cAAc,CAAC,eAAe,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,YAAY,CAAC,CAAA;IAC/D,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;QACtB,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ;YACpC,CAAC,CAAC,iCAAiC;YACnC,CAAC,CAAC,2CAA2C,CAAC,CAAC,CAAA;IACnD,CAAC;IACD,OAAO,CAAC,MAAM,GAAG,KAAK,EAAE,EAAE,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC,CAAA;AACjE,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** Pure complete-session Markdown export, independent of viewport truncation. */
|
|
2
|
+
import type { SessionEvent } from '@deepseek-ai/dsh-session';
|
|
3
|
+
/** Serialize every searchable semantic event in log order. */
|
|
4
|
+
export declare function formatTranscriptMarkdown(sessionId: string, title: string, events: readonly SessionEvent[]): string;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/** Pure complete-session Markdown export, independent of viewport truncation. */
|
|
2
|
+
import { extractSessionEventText } from '@deepseek-ai/dsh-session-query';
|
|
3
|
+
function contentMarkdown(content) {
|
|
4
|
+
if (!Array.isArray(content))
|
|
5
|
+
return '';
|
|
6
|
+
const parts = [];
|
|
7
|
+
for (const value of content) {
|
|
8
|
+
if (typeof value !== 'object' || value === null)
|
|
9
|
+
continue;
|
|
10
|
+
const block = value;
|
|
11
|
+
if (block.type === 'text' && typeof block.text === 'string')
|
|
12
|
+
parts.push(block.text);
|
|
13
|
+
else if (block.type === 'reasoning' && typeof block.text === 'string')
|
|
14
|
+
parts.push(`> Reasoning: ${block.text}`);
|
|
15
|
+
else if (block.type === 'tool-call')
|
|
16
|
+
parts.push(`Tool call ${String(block.name ?? '')}\n\n\`\`\`json\n${String(block.arguments ?? '')}\n\`\`\``);
|
|
17
|
+
else if (block.type === 'tool-result')
|
|
18
|
+
parts.push(contentMarkdown(block.content));
|
|
19
|
+
else if (block.type === 'image') {
|
|
20
|
+
const attachment = typeof block.attachment === 'object' && block.attachment !== null
|
|
21
|
+
? block.attachment
|
|
22
|
+
: {};
|
|
23
|
+
const size = typeof attachment.width === 'number' && typeof attachment.height === 'number'
|
|
24
|
+
? ` ${attachment.width}×${attachment.height}`
|
|
25
|
+
: '';
|
|
26
|
+
parts.push(`[image${size}${typeof attachment.mediaType === 'string' ? ' · ' + attachment.mediaType : ''}]`);
|
|
27
|
+
}
|
|
28
|
+
else if (typeof block.type === 'string')
|
|
29
|
+
parts.push(`[${block.type}]`);
|
|
30
|
+
}
|
|
31
|
+
return parts.filter(Boolean).join('\n\n');
|
|
32
|
+
}
|
|
33
|
+
function eventMarkdown(event) {
|
|
34
|
+
if (event.type === 'user/message')
|
|
35
|
+
return contentMarkdown(event.data.content);
|
|
36
|
+
if (event.type === 'assistant/message')
|
|
37
|
+
return contentMarkdown(event.data.message.content);
|
|
38
|
+
if (event.type === 'tool/call')
|
|
39
|
+
return `\`\`\`json\n${event.data.arguments}\n\`\`\``;
|
|
40
|
+
if (event.type === 'tool/result')
|
|
41
|
+
return contentMarkdown(event.data.message.content);
|
|
42
|
+
return extractSessionEventText(event);
|
|
43
|
+
}
|
|
44
|
+
function heading(event) {
|
|
45
|
+
if (event.type === 'user/message')
|
|
46
|
+
return 'User';
|
|
47
|
+
if (event.type === 'assistant/message')
|
|
48
|
+
return 'Assistant';
|
|
49
|
+
if (event.type === 'tool/call')
|
|
50
|
+
return `Tool call: ${event.data.name}`;
|
|
51
|
+
if (event.type === 'tool/result')
|
|
52
|
+
return 'Tool result';
|
|
53
|
+
return event.type;
|
|
54
|
+
}
|
|
55
|
+
/** Serialize every searchable semantic event in log order. */
|
|
56
|
+
export function formatTranscriptMarkdown(sessionId, title, events) {
|
|
57
|
+
const sections = [`# ${title}`, '', `Session: \`${sessionId}\``, ''];
|
|
58
|
+
for (const event of events) {
|
|
59
|
+
const body = eventMarkdown(event).trim();
|
|
60
|
+
if (body === '')
|
|
61
|
+
continue;
|
|
62
|
+
sections.push(`## ${heading(event)}`, '', body, '');
|
|
63
|
+
}
|
|
64
|
+
return sections.join('\n');
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=transcript-export.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transcript-export.js","sourceRoot":"","sources":["../src/transcript-export.ts"],"names":[],"mappings":"AAAA,iFAAiF;AAEjF,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAA;AAGxE,SAAS,eAAe,CAAC,OAAgB;IACvC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC;QAAE,OAAO,EAAE,CAAA;IACtC,MAAM,KAAK,GAAa,EAAE,CAAA;IAC1B,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;QAC5B,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;YAAE,SAAQ;QACzD,MAAM,KAAK,GAAG,KAAgC,CAAA;QAC9C,IAAI,KAAK,CAAC,IAAI,KAAK,MAAM,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ;YAAE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;aAC9E,IAAI,KAAK,CAAC,IAAI,KAAK,WAAW,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ;YAAE,KAAK,CAAC,IAAI,CAAC,gBAAgB,KAAK,CAAC,IAAI,EAAE,CAAC,CAAA;aAC1G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AAC,IAAI,CAAC,MAAM,OAAO,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,CAAC,CAAA;IACrD,CAAC;IACD,OAAO,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AAC5B,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Durable TUI appearance and status-line preferences on the user-settings seam.
|
|
3
|
+
* @module @agi-fans/dsh-tui
|
|
4
|
+
*/
|
|
5
|
+
import z from '@deepseek-ai/schemastery';
|
|
6
|
+
import { type StatusBarConfig, type StatusPreset } from './status-config.ts';
|
|
7
|
+
import { type ThemeName } from './theme.ts';
|
|
8
|
+
/** Settings namespace owned by the local TUI provider. */
|
|
9
|
+
export declare const TUI_SETTINGS_NAMESPACE = "omdsh-tui";
|
|
10
|
+
/** Durable TUI section stored in the user settings document. */
|
|
11
|
+
export interface TuiSettings {
|
|
12
|
+
theme: ThemeName;
|
|
13
|
+
colors: boolean;
|
|
14
|
+
expandTools: boolean;
|
|
15
|
+
statusBar?: StatusBarConfig;
|
|
16
|
+
/** Legacy input retained so older settings documents can be migrated. */
|
|
17
|
+
statusPreset?: StatusPreset;
|
|
18
|
+
}
|
|
19
|
+
/** Schema: palette, SGR, tool expansion, and status-line detail. */
|
|
20
|
+
export declare const TuiSettingsSchema: z<TuiSettings>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Durable TUI appearance and status-line preferences on the user-settings seam.
|
|
3
|
+
* @module @agi-fans/dsh-tui
|
|
4
|
+
*/
|
|
5
|
+
import z from '@deepseek-ai/schemastery';
|
|
6
|
+
import { STATUS_GROUP_IDS, STATUS_LABEL_STYLES, STATUS_PRESETS, } from "./status-config.js";
|
|
7
|
+
import { THEME_NAMES } from "./theme.js";
|
|
8
|
+
/** Settings namespace owned by the local TUI provider. */
|
|
9
|
+
export const TUI_SETTINGS_NAMESPACE = 'omdsh-tui';
|
|
10
|
+
/** Schema: palette, SGR, tool expansion, and status-line detail. */
|
|
11
|
+
export const TuiSettingsSchema = z.object({
|
|
12
|
+
theme: z.union([...THEME_NAMES]).default('dark'),
|
|
13
|
+
colors: z.boolean().default(true),
|
|
14
|
+
expandTools: z.boolean().default(false),
|
|
15
|
+
statusBar: z.union([z.object({
|
|
16
|
+
enabled: z.boolean().default(true),
|
|
17
|
+
labels: z.union([...STATUS_LABEL_STYLES]).default('compact'),
|
|
18
|
+
groups: z.array(z.union([...STATUS_GROUP_IDS])).default([...STATUS_GROUP_IDS]),
|
|
19
|
+
order: z.array(z.union([...STATUS_GROUP_IDS])),
|
|
20
|
+
})]),
|
|
21
|
+
statusPreset: z.union([...STATUS_PRESETS]),
|
|
22
|
+
});
|
|
23
|
+
//# sourceMappingURL=tui-settings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tui-settings.js","sourceRoot":"","sources":["../src/tui-settings.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,CAAC,MAAM,0BAA0B,CAAA;AACxC,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,cAAc,GAGf,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,WAAW,EAAkB,MAAM,YAAY,CAAA;AAExD,0DAA0D;AAC1D,MAAM,CAAC,MAAM,sBAAsB,GAAG,WAAW,CAAA;AAYjD,oEAAoE;AACpE,MAAM,CAAC,MAAM,iBAAiB,GAAmB,CAAC,CAAC,MAAM,CAAC;IACxD,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC;IAChD,MAAM,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;IACjC,WAAW,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;IACvC,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;YAC3B,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;YAClC,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,mBAAmB,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC;YAC5D,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,gBAAgB,CAAC,CAAC;YAC9E,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,gBAAgB,CAAC,CAAC,CAAC;SAC/C,CAAC,CAAC,CAAC;IACJ,YAAY,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,cAAc,CAAC,CAAC;CAC3C,CAAC,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Small, truthful startup hints sampled once for each TUI process. */
|
|
2
|
+
/** One compact key/action pair rendered in the welcome card. */
|
|
3
|
+
export interface WelcomeTip {
|
|
4
|
+
key: string;
|
|
5
|
+
text: string;
|
|
6
|
+
}
|
|
7
|
+
/** Capabilities worth surfacing without turning the welcome card into a manual. */
|
|
8
|
+
export declare const WELCOME_TIPS: readonly WelcomeTip[];
|
|
9
|
+
/** Pick distinct hints without mutating the shared catalog. */
|
|
10
|
+
export declare function pickWelcomeTips(random?: () => number, count?: number): readonly WelcomeTip[];
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/** Small, truthful startup hints sampled once for each TUI process. */
|
|
2
|
+
/** Capabilities worth surfacing without turning the welcome card into a manual. */
|
|
3
|
+
export const WELCOME_TIPS = [
|
|
4
|
+
{ key: '/', text: 'Browse available commands' },
|
|
5
|
+
{ key: 'Tab', text: 'Complete commands and paths' },
|
|
6
|
+
{ key: 'Ctrl+R', text: 'Search and reuse prompt history' },
|
|
7
|
+
{ key: 'Ctrl+O', text: 'Expand or collapse tool output' },
|
|
8
|
+
{ key: 'PgUp/PgDn', text: 'Scroll through the transcript' },
|
|
9
|
+
{ key: 'Shift+Enter/Ctrl+J', text: 'Insert a newline in the composer' },
|
|
10
|
+
{ key: 'Ctrl+C ×2', text: 'Exit with a resumable session hint' },
|
|
11
|
+
{ key: '/resume', text: 'Continue a durable session' },
|
|
12
|
+
{ key: '/model', text: 'Switch model and reasoning effort' },
|
|
13
|
+
{ key: '/plan', text: 'Plan before making workspace changes' },
|
|
14
|
+
{ key: '/mode', text: 'Choose the session access mode' },
|
|
15
|
+
{ key: '/settings', text: 'Customize appearance and status' },
|
|
16
|
+
{ key: '/copy code', text: 'Copy the latest code block' },
|
|
17
|
+
{ key: '/search', text: 'Find text in this transcript' },
|
|
18
|
+
{ key: 'Ctrl+V', text: 'Paste an image or clipboard text' },
|
|
19
|
+
{ key: '/tools', text: 'Inspect tools available to the agent' },
|
|
20
|
+
{ key: '/mcp', text: 'Inspect connected MCP servers' },
|
|
21
|
+
];
|
|
22
|
+
/** Pick distinct hints without mutating the shared catalog. */
|
|
23
|
+
export function pickWelcomeTips(random = Math.random, count = 4) {
|
|
24
|
+
const pool = [...WELCOME_TIPS];
|
|
25
|
+
const picked = [];
|
|
26
|
+
const limit = Math.max(0, Math.min(Math.floor(count), pool.length));
|
|
27
|
+
while (picked.length < limit) {
|
|
28
|
+
const sample = Math.max(0, Math.min(0.9999999999999999, random()));
|
|
29
|
+
const index = Math.floor(sample * pool.length);
|
|
30
|
+
const [tip] = pool.splice(index, 1);
|
|
31
|
+
if (tip !== undefined)
|
|
32
|
+
picked.push(tip);
|
|
33
|
+
}
|
|
34
|
+
return picked;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=welcome-tips.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"welcome-tips.js","sourceRoot":"","sources":["../src/welcome-tips.ts"],"names":[],"mappings":"AAAA,uEAAu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,CAAC;IAEjB,MAAM,IAAI,GAAG,CAAC,GAAG,YAAY,CAAC,CAAA;IAC9B,MAAM,MAAM,GAAiB,EAAE,CAAA;IAC/B,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAA;IACnE,OAAO,MAAM,CAAC,MAAM,GAAG,KAAK,EAAE,CAAC;QAC7B,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,kBAAkB,EAAE,MAAM,EAAE,CAAC,CAAC,CAAA;QAClE,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,CAAA;QAC9C,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAA;QACnC,IAAI,GAAG,KAAK,SAAS;YAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IACzC,CAAC;IACD,OAAO,MAAM,CAAA;AACf,CAAC"}
|
package/lib/width.d.ts
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ANSI-aware terminal cell metrics. Frames are laid out in visible columns,
|
|
3
|
+
* not string lengths — SGR / OSC sequences and wide glyphs must not shift
|
|
4
|
+
* box chrome.
|
|
5
|
+
* @module @agi-fans/dsh-tui
|
|
6
|
+
*/
|
|
7
|
+
/** Strip CSI / OSC sequences, leaving only displayable text. */
|
|
8
|
+
export declare function stripAnsi(text: string): string;
|
|
9
|
+
/** East-Asian / emoji / combining-mark cell width of one code point. */
|
|
10
|
+
export declare function charWidth(cp: number): number;
|
|
11
|
+
/** Visible column count, ignoring ANSI and counting wide glyphs as two cells. */
|
|
12
|
+
export declare function visibleWidth(text: string): number;
|
|
13
|
+
/** Split `text` into ANSI vs printable runs. */
|
|
14
|
+
export declare function splitAnsi(text: string): {
|
|
15
|
+
ansi: boolean;
|
|
16
|
+
value: string;
|
|
17
|
+
}[];
|
|
18
|
+
/**
|
|
19
|
+
* Replace tabs with spaces using terminal tab stops while preserving ANSI.
|
|
20
|
+
* `initialColumn` is the screen column where the text will begin.
|
|
21
|
+
*/
|
|
22
|
+
export declare function expandTabs(text: string, tabWidth?: number, initialColumn?: number): string;
|
|
23
|
+
/** `n` spaces, or empty when n < 1. */
|
|
24
|
+
export declare function padding(n: number): string;
|
|
25
|
+
/**
|
|
26
|
+
* Truncate to `width` cells, preserving leading ANSI and appending an ellipsis.
|
|
27
|
+
* Closes SGR so a cut mid-style cannot bleed into the next cell.
|
|
28
|
+
*/
|
|
29
|
+
export declare function truncateToWidth(text: string, width: number, ellipsis?: string): string;
|
|
30
|
+
/** Pad (or truncate) so the line occupies exactly `width` cells. */
|
|
31
|
+
export declare function padToWidth(text: string, width: number): string;
|
|
32
|
+
/**
|
|
33
|
+
* Word-wrap `text` to `width` cells, keeping ANSI attached to the following
|
|
34
|
+
* glyph. Newlines are hard breaks. Words longer than `width` are split.
|
|
35
|
+
*/
|
|
36
|
+
export declare function wrapText(text: string, width: number): string[];
|
|
37
|
+
/** One wrapped row with its source-index span in the original (unstyled) string. */
|
|
38
|
+
export interface IndexedLine {
|
|
39
|
+
text: string;
|
|
40
|
+
start: number;
|
|
41
|
+
end: number;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Wrap plain `text` (no ANSI) to `width`, carrying source offsets so a cursor
|
|
45
|
+
* index can be mapped to (row, column).
|
|
46
|
+
*/
|
|
47
|
+
export declare function wrapIndexed(text: string, width: number): IndexedLine[];
|
|
48
|
+
/** Map a visible column on a wrapped row back to a source index. */
|
|
49
|
+
export declare function indexOnWrapped(line: IndexedLine, column: number, source: string): number;
|
|
50
|
+
/** Map a source cursor index onto wrapped rows. */
|
|
51
|
+
export declare function cursorOnWrapped(lines: readonly IndexedLine[], cursor: number, source: string): {
|
|
52
|
+
row: number;
|
|
53
|
+
column: number;
|
|
54
|
+
};
|
package/lib/width.js
ADDED
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ANSI-aware terminal cell metrics. Frames are laid out in visible columns,
|
|
3
|
+
* not string lengths — SGR / OSC sequences and wide glyphs must not shift
|
|
4
|
+
* box chrome.
|
|
5
|
+
* @module @agi-fans/dsh-tui
|
|
6
|
+
*/
|
|
7
|
+
const ANSI_RE = /\x1b(?:\[[0-9;?]*[ -/]*[@-~]|].[^\x07\x1b]*(?:\x07|\x1b\\))/g;
|
|
8
|
+
/** Strip CSI / OSC sequences, leaving only displayable text. */
|
|
9
|
+
export function stripAnsi(text) {
|
|
10
|
+
return text.replace(ANSI_RE, '');
|
|
11
|
+
}
|
|
12
|
+
/** East-Asian / emoji / combining-mark cell width of one code point. */
|
|
13
|
+
export function charWidth(cp) {
|
|
14
|
+
if (cp === 0)
|
|
15
|
+
return 0;
|
|
16
|
+
if (cp < 0x20 || (cp >= 0x7f && cp < 0xa0))
|
|
17
|
+
return 0;
|
|
18
|
+
if (cp >= 0x300 && cp <= 0x36f)
|
|
19
|
+
return 0;
|
|
20
|
+
if (cp >= 0xfe00 && cp <= 0xfe0f)
|
|
21
|
+
return 0;
|
|
22
|
+
if (cp === 0x200d || cp === 0xfe0f)
|
|
23
|
+
return 0;
|
|
24
|
+
if ((cp >= 0x1100 && cp <= 0x115f)
|
|
25
|
+
|| cp === 0x2329
|
|
26
|
+
|| cp === 0x232a
|
|
27
|
+
|| (cp >= 0x2e80 && cp <= 0xa4cf && cp !== 0x303f)
|
|
28
|
+
|| (cp >= 0xac00 && cp <= 0xd7a3)
|
|
29
|
+
|| (cp >= 0xf900 && cp <= 0xfaff)
|
|
30
|
+
|| (cp >= 0xfe10 && cp <= 0xfe19)
|
|
31
|
+
|| (cp >= 0xfe30 && cp <= 0xfe6f)
|
|
32
|
+
|| (cp >= 0xff00 && cp <= 0xff60)
|
|
33
|
+
|| (cp >= 0xffe0 && cp <= 0xffe6)
|
|
34
|
+
|| (cp >= 0x1f300 && cp <= 0x1f64f)
|
|
35
|
+
|| (cp >= 0x1f900 && cp <= 0x1f9ff)
|
|
36
|
+
|| (cp >= 0x1fa00 && cp <= 0x1faff))
|
|
37
|
+
return 2;
|
|
38
|
+
return 1;
|
|
39
|
+
}
|
|
40
|
+
/** Visible column count, ignoring ANSI and counting wide glyphs as two cells. */
|
|
41
|
+
export function visibleWidth(text) {
|
|
42
|
+
let width = 0;
|
|
43
|
+
for (const ch of stripAnsi(text)) {
|
|
44
|
+
width += charWidth(ch.codePointAt(0) ?? 0);
|
|
45
|
+
}
|
|
46
|
+
return width;
|
|
47
|
+
}
|
|
48
|
+
/** Split `text` into ANSI vs printable runs. */
|
|
49
|
+
export function splitAnsi(text) {
|
|
50
|
+
const parts = [];
|
|
51
|
+
let last = 0;
|
|
52
|
+
for (const match of text.matchAll(ANSI_RE)) {
|
|
53
|
+
const index = match.index;
|
|
54
|
+
if (index > last)
|
|
55
|
+
parts.push({ ansi: false, value: text.slice(last, index) });
|
|
56
|
+
parts.push({ ansi: true, value: match[0] ?? '' });
|
|
57
|
+
last = index + (match[0]?.length ?? 0);
|
|
58
|
+
}
|
|
59
|
+
if (last < text.length)
|
|
60
|
+
parts.push({ ansi: false, value: text.slice(last) });
|
|
61
|
+
return parts;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Replace tabs with spaces using terminal tab stops while preserving ANSI.
|
|
65
|
+
* `initialColumn` is the screen column where the text will begin.
|
|
66
|
+
*/
|
|
67
|
+
export function expandTabs(text, tabWidth = 8, initialColumn = 0) {
|
|
68
|
+
const size = Math.max(1, Math.trunc(tabWidth));
|
|
69
|
+
let column = Math.max(0, Math.trunc(initialColumn));
|
|
70
|
+
let out = '';
|
|
71
|
+
for (const part of splitAnsi(text)) {
|
|
72
|
+
if (part.ansi) {
|
|
73
|
+
out += part.value;
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
for (const char of part.value) {
|
|
77
|
+
if (char === '\t') {
|
|
78
|
+
const spaces = size - (column % size);
|
|
79
|
+
out += ' '.repeat(spaces);
|
|
80
|
+
column += spaces;
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
out += char;
|
|
84
|
+
if (char === '\n')
|
|
85
|
+
column = Math.max(0, Math.trunc(initialColumn));
|
|
86
|
+
else
|
|
87
|
+
column += charWidth(char.codePointAt(0) ?? 0);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return out;
|
|
92
|
+
}
|
|
93
|
+
/** `n` spaces, or empty when n < 1. */
|
|
94
|
+
export function padding(n) {
|
|
95
|
+
return n > 0 ? ' '.repeat(n) : '';
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Truncate to `width` cells, preserving leading ANSI and appending an ellipsis.
|
|
99
|
+
* Closes SGR so a cut mid-style cannot bleed into the next cell.
|
|
100
|
+
*/
|
|
101
|
+
export function truncateToWidth(text, width, ellipsis = '…') {
|
|
102
|
+
if (width <= 0)
|
|
103
|
+
return '';
|
|
104
|
+
if (visibleWidth(text) <= width)
|
|
105
|
+
return text;
|
|
106
|
+
const ellW = visibleWidth(ellipsis);
|
|
107
|
+
const budget = Math.max(0, width - ellW);
|
|
108
|
+
let out = '';
|
|
109
|
+
let used = 0;
|
|
110
|
+
for (const part of splitAnsi(text)) {
|
|
111
|
+
if (part.ansi) {
|
|
112
|
+
out += part.value;
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
for (const ch of part.value) {
|
|
116
|
+
const cw = charWidth(ch.codePointAt(0) ?? 0);
|
|
117
|
+
if (used + cw > budget)
|
|
118
|
+
return out + ellipsis + '\x1b[0m';
|
|
119
|
+
out += ch;
|
|
120
|
+
used += cw;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return out + ellipsis + '\x1b[0m';
|
|
124
|
+
}
|
|
125
|
+
/** Pad (or truncate) so the line occupies exactly `width` cells. */
|
|
126
|
+
export function padToWidth(text, width) {
|
|
127
|
+
const used = visibleWidth(text);
|
|
128
|
+
if (used === width)
|
|
129
|
+
return text;
|
|
130
|
+
if (used > width)
|
|
131
|
+
return truncateToWidth(text, width);
|
|
132
|
+
return text + padding(width - used);
|
|
133
|
+
}
|
|
134
|
+
function splitWordsPreservingAnsi(text) {
|
|
135
|
+
const words = [];
|
|
136
|
+
let buf = '';
|
|
137
|
+
let inEsc = false;
|
|
138
|
+
for (const ch of text) {
|
|
139
|
+
if (ch === '\x1b') {
|
|
140
|
+
inEsc = true;
|
|
141
|
+
buf += ch;
|
|
142
|
+
continue;
|
|
143
|
+
}
|
|
144
|
+
if (inEsc) {
|
|
145
|
+
buf += ch;
|
|
146
|
+
if (ch >= '@' && ch <= '~')
|
|
147
|
+
inEsc = false;
|
|
148
|
+
continue;
|
|
149
|
+
}
|
|
150
|
+
if (ch === ' ') {
|
|
151
|
+
if (buf !== '')
|
|
152
|
+
words.push(buf);
|
|
153
|
+
buf = '';
|
|
154
|
+
}
|
|
155
|
+
else {
|
|
156
|
+
buf += ch;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
if (buf !== '')
|
|
160
|
+
words.push(buf);
|
|
161
|
+
return words;
|
|
162
|
+
}
|
|
163
|
+
function hardWrapAnsi(text, width) {
|
|
164
|
+
const lines = [];
|
|
165
|
+
let current = '';
|
|
166
|
+
let currentW = 0;
|
|
167
|
+
let pending = '';
|
|
168
|
+
for (const part of splitAnsi(text)) {
|
|
169
|
+
if (part.ansi) {
|
|
170
|
+
pending += part.value;
|
|
171
|
+
continue;
|
|
172
|
+
}
|
|
173
|
+
for (const ch of part.value) {
|
|
174
|
+
const cw = charWidth(ch.codePointAt(0) ?? 0);
|
|
175
|
+
if (currentW + cw > width && currentW > 0) {
|
|
176
|
+
lines.push(current);
|
|
177
|
+
current = '';
|
|
178
|
+
currentW = 0;
|
|
179
|
+
}
|
|
180
|
+
current += pending + ch;
|
|
181
|
+
pending = '';
|
|
182
|
+
currentW += cw;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
if (pending !== '')
|
|
186
|
+
current += pending;
|
|
187
|
+
if (current !== '' || lines.length === 0)
|
|
188
|
+
lines.push(current);
|
|
189
|
+
return lines;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Word-wrap `text` to `width` cells, keeping ANSI attached to the following
|
|
193
|
+
* glyph. Newlines are hard breaks. Words longer than `width` are split.
|
|
194
|
+
*/
|
|
195
|
+
export function wrapText(text, width) {
|
|
196
|
+
if (width <= 0)
|
|
197
|
+
return [''];
|
|
198
|
+
const out = [];
|
|
199
|
+
for (const para of text.split('\n')) {
|
|
200
|
+
if (para === '') {
|
|
201
|
+
out.push('');
|
|
202
|
+
continue;
|
|
203
|
+
}
|
|
204
|
+
if (visibleWidth(para) <= width) {
|
|
205
|
+
out.push(para);
|
|
206
|
+
continue;
|
|
207
|
+
}
|
|
208
|
+
const words = splitWordsPreservingAnsi(para);
|
|
209
|
+
let line = '';
|
|
210
|
+
let lineW = 0;
|
|
211
|
+
for (const word of words) {
|
|
212
|
+
const wordW = visibleWidth(word);
|
|
213
|
+
const extra = line === '' ? 0 : 1;
|
|
214
|
+
if (lineW + extra + wordW <= width) {
|
|
215
|
+
line += (line === '' ? '' : ' ') + word;
|
|
216
|
+
lineW += extra + wordW;
|
|
217
|
+
}
|
|
218
|
+
else if (wordW <= width) {
|
|
219
|
+
if (line !== '')
|
|
220
|
+
out.push(line);
|
|
221
|
+
line = word;
|
|
222
|
+
lineW = wordW;
|
|
223
|
+
}
|
|
224
|
+
else {
|
|
225
|
+
if (line !== '')
|
|
226
|
+
out.push(line);
|
|
227
|
+
const chunks = hardWrapAnsi(word, width);
|
|
228
|
+
out.push(...chunks.slice(0, -1));
|
|
229
|
+
line = chunks[chunks.length - 1] ?? '';
|
|
230
|
+
lineW = visibleWidth(line);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
if (line !== '')
|
|
234
|
+
out.push(line);
|
|
235
|
+
}
|
|
236
|
+
return out.length > 0 ? out : [''];
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Wrap plain `text` (no ANSI) to `width`, carrying source offsets so a cursor
|
|
240
|
+
* index can be mapped to (row, column).
|
|
241
|
+
*/
|
|
242
|
+
export function wrapIndexed(text, width) {
|
|
243
|
+
if (width <= 0)
|
|
244
|
+
return [{ text: '', start: 0, end: 0 }];
|
|
245
|
+
const lines = [];
|
|
246
|
+
let start = 0;
|
|
247
|
+
let used = 0;
|
|
248
|
+
let breakAt = -1;
|
|
249
|
+
const flush = (end) => {
|
|
250
|
+
lines.push({ text: text.slice(start, end), start, end });
|
|
251
|
+
};
|
|
252
|
+
for (let i = 0; i < text.length;) {
|
|
253
|
+
const cp = text.codePointAt(i) ?? 0;
|
|
254
|
+
const ch = String.fromCodePoint(cp);
|
|
255
|
+
if (ch === '\n') {
|
|
256
|
+
flush(i);
|
|
257
|
+
i += ch.length;
|
|
258
|
+
start = i;
|
|
259
|
+
used = 0;
|
|
260
|
+
breakAt = -1;
|
|
261
|
+
continue;
|
|
262
|
+
}
|
|
263
|
+
const cw = charWidth(cp);
|
|
264
|
+
if (used + cw > width && i > start) {
|
|
265
|
+
const cut = breakAt >= start ? breakAt : i;
|
|
266
|
+
flush(cut);
|
|
267
|
+
start = breakAt >= start ? breakAt + 1 : i;
|
|
268
|
+
used = 0;
|
|
269
|
+
breakAt = -1;
|
|
270
|
+
for (let j = start; j < i;) {
|
|
271
|
+
const cp2 = text.codePointAt(j) ?? 0;
|
|
272
|
+
const ch2 = String.fromCodePoint(cp2);
|
|
273
|
+
if (ch2 === ' ')
|
|
274
|
+
breakAt = j;
|
|
275
|
+
used += charWidth(cp2);
|
|
276
|
+
j += ch2.length;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
if (ch === ' ')
|
|
280
|
+
breakAt = i;
|
|
281
|
+
used += cw;
|
|
282
|
+
i += ch.length;
|
|
283
|
+
}
|
|
284
|
+
flush(text.length);
|
|
285
|
+
return lines.length > 0 ? lines : [{ text: '', start: 0, end: 0 }];
|
|
286
|
+
}
|
|
287
|
+
/** Map a visible column on a wrapped row back to a source index. */
|
|
288
|
+
export function indexOnWrapped(line, column, source) {
|
|
289
|
+
const target = Math.max(0, column);
|
|
290
|
+
let col = 0;
|
|
291
|
+
let i = line.start;
|
|
292
|
+
while (i < line.end) {
|
|
293
|
+
const cp = source.codePointAt(i) ?? 0;
|
|
294
|
+
const ch = String.fromCodePoint(cp);
|
|
295
|
+
const width = charWidth(cp);
|
|
296
|
+
if (col + width > target)
|
|
297
|
+
return i;
|
|
298
|
+
col += width;
|
|
299
|
+
i += ch.length;
|
|
300
|
+
}
|
|
301
|
+
return line.end;
|
|
302
|
+
}
|
|
303
|
+
/** Map a source cursor index onto wrapped rows. */
|
|
304
|
+
export function cursorOnWrapped(lines, cursor, source) {
|
|
305
|
+
if (lines.length === 0)
|
|
306
|
+
return { row: 0, column: 0 };
|
|
307
|
+
for (let i = 0; i < lines.length; i += 1) {
|
|
308
|
+
const line = lines[i];
|
|
309
|
+
if (line === undefined)
|
|
310
|
+
continue;
|
|
311
|
+
const next = lines[i + 1];
|
|
312
|
+
if (next !== undefined && cursor === line.end && next.start === cursor)
|
|
313
|
+
continue;
|
|
314
|
+
if (cursor >= line.start && cursor <= line.end) {
|
|
315
|
+
return { row: i, column: visibleWidth(source.slice(line.start, cursor)) };
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
const last = lines[lines.length - 1];
|
|
319
|
+
if (last === undefined)
|
|
320
|
+
return { row: 0, column: 0 };
|
|
321
|
+
return { row: lines.length - 1, column: visibleWidth(last.text) };
|
|
322
|
+
}
|
|
323
|
+
//# sourceMappingURL=width.js.map
|
package/lib/width.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"width.js","sourceRoot":"","sources":["../src/width.ts"],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