@fresh-editor/fresh-editor 0.3.2 → 0.3.5
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/CHANGELOG.md +100 -0
- package/package.json +1 -1
- package/plugins/config-schema.json +9 -1
- package/plugins/diagnostics_panel.ts +4 -0
- package/plugins/find_references.ts +4 -0
- package/plugins/git_explorer.ts +9 -1
- package/plugins/git_grep.ts +3 -1
- package/plugins/lib/finder.ts +108 -16
- package/plugins/lib/fresh.d.ts +49 -4
- package/plugins/live_grep.i18n.json +42 -14
- package/plugins/live_grep.ts +558 -42
- package/plugins/markdown_compose.ts +17 -3
- package/plugins/schemas/theme.schema.json +462 -12
- package/plugins/search_replace.ts +5 -0
- package/plugins/theme_editor.i18n.json +112 -0
- package/plugins/theme_editor.ts +58 -50
- package/themes/dark.json +2 -0
- package/themes/high-contrast.json +2 -0
- package/themes/light.json +2 -0
- package/themes/nord.json +5 -0
- package/themes/nostalgia.json +2 -0
- package/themes/solarized-dark.json +5 -0
- package/themes/terminal.json +128 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,105 @@
|
|
|
1
1
|
# Release Notes
|
|
2
2
|
|
|
3
|
+
## 0.3.5
|
|
4
|
+
|
|
5
|
+
### Improvements
|
|
6
|
+
|
|
7
|
+
* **Live Grep overlay polish**: Surrounding editor is now visibly dimmed; shortcut hints and the active provider moved into a toolbar row with plainer labels; match cap raised from 100 to 1000 (with a `1000+ matches` indicator); provider errors render as a disabled result entry instead of a silent "0 matches"; `ripgrep` provider renamed to `rg`.
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **Live Grep on Windows returned no results**: `git grep` outputs `\r\n`; splitting on `\n` left a trailing `\r` that broke the result regex. Split on `\r?\n` instead.
|
|
12
|
+
|
|
13
|
+
* **Plain `grep` provider was broken**: `--column` is a ripgrep-only flag and was being passed unconditionally. Removed.
|
|
14
|
+
|
|
15
|
+
### Under the Hood
|
|
16
|
+
|
|
17
|
+
* **Plugin API: `setPromptTitle` takes styled segments** (`{ text, style? }[]`) instead of a single string, so plugins control hint colouring directly instead of the renderer guessing structure from punctuation.
|
|
18
|
+
|
|
19
|
+
## 0.3.4
|
|
20
|
+
|
|
21
|
+
### Features
|
|
22
|
+
|
|
23
|
+
* **Live Grep floating overlay + Utility Dock** (#1796): Live Grep now opens as a centered floating overlay with results on the left and a real-buffer file preview on the right (full syntax highlighting, gutter, soft-wrap). `Esc` returns you to your prior layout exactly. **Resume** (`Alt+r`) reopens the last query with cached results. **Export to Quickfix** (`Alt+M`) sends results into a dockable list.
|
|
24
|
+
|
|
25
|
+
* New **Utility Dock** at the workspace root hosts the terminal (`` Alt+` ``), Quickfix, Diagnostics, and Find References — they share one pane spanning the full width instead of nesting under whichever split was focused.
|
|
26
|
+
|
|
27
|
+
* **Pluggable Live Grep providers**: Built-in chain is now ripgrep → **git-grep (default in repos)** → grep, with `ag` / `ack` available via plugin registration. `Alt+P` cycles to the next available provider; the active one shows in the overlay's title bar. Plugins can register custom backends via `editor.getPluginApi("live-grep")`.
|
|
28
|
+
|
|
29
|
+
* **Settings tree-view**: The left category list is now an expandable tree — categories with multiple sections show chevrons, expanding reveals jumpable section rows, and the tree cursor follows scrolling so you can see where you are in the body. Section jumps snap to the top of the section. Toggle controls render as a chip-style `[ ✓ ACTIVE ]` indicator.
|
|
30
|
+
|
|
31
|
+
* **HDL language support** (#1528, reported by @bqinTT): Syntax highlighting for **Verilog** (`.v` left mapped to vlang for compatibility, `.vh`/`.verilog`), **SystemVerilog** (`.sv`/`.svh`/`.svi`/`.svp`), and **VHDL** (`.vhd`/`.vhdl`/`.vho`). `svls` wired as the default LSP for Verilog/SystemVerilog (opt-in per project).
|
|
32
|
+
|
|
33
|
+
* **New `terminal` built-in theme** (#1457, #1798, reported by @AmethystGosling169 and @BrettKinny): Colors come from your terminal's own palette instead of hard-coded RGB — backgrounds use `Default` so transparency and your terminal's background show through; accents use ANSI named colors that remap to whatever your terminal colorscheme defines. Selection uses reverse-video so it inverts whatever colors are already on screen.
|
|
34
|
+
|
|
35
|
+
* **Theme inheritance with `extends`**: User themes can now `extends: "builtin://light"` (or `dark` / `high-contrast` / `nostalgia` / `terminal`) and layer overrides on top — the same model VSCode/Helix/Sublime/Zed use. With no `extends`, an explicit `editor.bg` triggers luminance-based auto-inference (bright bg → light base, dim → dark), so partial light themes no longer end up with dark UI chrome (#1281, reported by @nico2004444).
|
|
36
|
+
|
|
37
|
+
* **File explorer context-menu additions** (#1576, reported by @RandomGHUser): **Duplicate** (creates `name copy[.ext]` next to the source, multi-select supported), **Copy Full Path** and **Copy Relative Path** (newline-joined for multi-select). The new entries don't appear on the project root.
|
|
38
|
+
|
|
39
|
+
* **Distribute clipboard across cursors** (#1057, reported by @graphixillusion): With N cursors and an N-line clipboard, paste now gives each cursor one line in top-to-bottom order — VSCode / Notepad++ "column-mode paste" semantics. A block-selected copy/paste round-trip preserves its rectangular shape. Behavior is unchanged when counts don't match.
|
|
40
|
+
|
|
41
|
+
* **Discard option in quit prompt** (#1839, reported by @turkishmaid): With `hot_exit` on (the default), the unsaved-changes prompt now offers "(d)iscard and quit" so accidental edits no longer require disabling hot_exit globally to throw away. Picking "save" on quit also chains a Save As prompt for each dirty unnamed buffer instead of silently dropping it.
|
|
42
|
+
|
|
43
|
+
* **Project name in window title** (#1793, reported by @dAnjou): Title is now `<file> — <project> — Fresh` so multiple Fresh sessions in different projects are distinguishable in your taskbar/window list.
|
|
44
|
+
|
|
45
|
+
* **Cursor-jump animation toggle** (#1788): New `editor.cursor_jump_animation` setting lets you keep ambient animations (tab slides, dashboard) while disabling just the cursor-jump trail. The master `editor.animations` setting still wins.
|
|
46
|
+
|
|
47
|
+
### Improvements
|
|
48
|
+
|
|
49
|
+
* **Search & Replace across project no longer hangs on large binary files** (#1342, reported by @dragonfyre13): Hardcoded extension fast-path skips known-binary files (compiled artifacts, archives, media, ML weights, fonts) before any I/O. Per-file size cap and stronger header sniff (PNG, ZIP-based archives like `.pth`, ELF) catch the formats whose first bytes can look text-like.
|
|
50
|
+
|
|
51
|
+
* **POSIX ACL writability** (#1765, reported by @cherouize): A file granted write access via `setfacl -m u:NAME:rw` is no longer reported read-only — Fresh now asks the kernel via `faccessat(W_OK)` instead of walking inode mode bits, so ACLs, capabilities, and read-only mounts are all honored.
|
|
52
|
+
|
|
53
|
+
* **LSP status popup doesn't auto-show**: Auto-popping on first file open stole focus and swallowed keystrokes for users who hadn't asked to enable LSP. The `LSP` indicator is now a manual click target; its `Off` state (configured but not running) is rendered with a more prominent attention-grabbing color so discoverability isn't lost.
|
|
54
|
+
|
|
55
|
+
* **Hover popup no longer flickers on mouse moves** (#692) inside the editor (gutter, end-of-line, between words). It only dismisses when the mouse leaves the editor area entirely. New hover responses replace the existing popup instead of stacking.
|
|
56
|
+
|
|
57
|
+
* **Multi-cursor `Ctrl-D` after substring search** (#1697, reported by @dtwilliamson): When the cursor is inside an active search match, "Add cursor at next match" selects the next *search match* instead of expanding to the surrounding word.
|
|
58
|
+
|
|
59
|
+
* **JavaScript syntax highlighting** (#899, reported by @comesuccingfuccsloot): Routed through tree-sitter, so template literals containing arrow functions or `${expr}` no longer leak `@string` styling across the rest of the file.
|
|
60
|
+
|
|
61
|
+
* **Smarter auto-indent for Lua / Ruby / Bash / Pascal**: Tree-sitter `indents.scm` is now the single source of truth for keyword-delimited languages, so `(` opening a function call no longer gets treated as a block-opening delimiter.
|
|
62
|
+
|
|
63
|
+
* **Enter at column 0 doesn't push the line right anymore** (#1425, reported by @goszlanyi): Auto-indent now detects "cursor at column 0 of a non-empty line" and inserts a bare newline. Closing-delimiter lines still get the established indent-before-close behavior.
|
|
64
|
+
|
|
65
|
+
* **Live Diff virtual lines soft-wrap** (#1787) instead of being truncated at the right edge.
|
|
66
|
+
|
|
67
|
+
* **Per-workspace hot-exit recovery** (#1550, reported by @goszlanyi): Standalone-mode recovery files are now scoped per working directory. Quitting Fresh in folder B no longer wipes folder A's recovered unnamed-buffer state.
|
|
68
|
+
|
|
69
|
+
* **Terminal PTY resyncs on tab reveal** (#1795): Resizing the host while a terminal was hidden behind another tab now correctly forwards `SIGWINCH` when you switch back — `$COLUMNS` / `stty size` stay accurate.
|
|
70
|
+
|
|
71
|
+
* **Open File dialog scrolls correctly on small terminals** (#245): Selection no longer slides past the bottom of the visible list.
|
|
72
|
+
|
|
73
|
+
* **Keybinding editor scrollbar responds to mouse** (#1593, reported by @Kodiak-01): Click and drag both work; wheel scrolls the viewport instead of moving the selection (so a scrollbar drag isn't undone by the next wheel tick).
|
|
74
|
+
|
|
75
|
+
* **Settings Number controls** (#1825, e.g. Tab Size): Tab now commits and exits the input; clicking the value cell enters edit mode (matches Enter).
|
|
76
|
+
|
|
77
|
+
* **Plugin keybinding labels refresh on every prompt open** so plugins surfacing key hints ("`Alt+P` to cycle", overlay headers, etc.) reflect mid-session rebinds without restart.
|
|
78
|
+
|
|
79
|
+
* **New plugin hook `after_file_explorer_change`** fires on FS-mutating explorer actions (Duplicate, Paste, New File, Rename, Delete) so plugins like git_explorer can refresh badges immediately.
|
|
80
|
+
|
|
81
|
+
* **Theme picker consistency**: The Theme Editor plugin's picker now shows the same set of themes as the native `Select Theme` prompt — no more divergence from a separate `cwd/themes` scan or normalization mismatches. New plugin API `editor.getAllThemes()` returns the cached map directly so plugins can drop their own filesystem walks.
|
|
82
|
+
|
|
83
|
+
### Bug Fixes
|
|
84
|
+
|
|
85
|
+
* **Crash fixes**: `Option::unwrap()` panic when pasting in the Theme Editor (event apply used the wrong split). `DeleteBackward` panics on stale cursor state in vi-mode count prefixes and plugin action batches. Theme editor crash on the new `terminal` theme's modifier fields. Embedded-plugin extraction race across concurrent test processes.
|
|
86
|
+
|
|
87
|
+
* **Search** (#1537, reported by @pstahle): `Find Selection Next/Previous` on a non-word character (e.g. `}` after goto-matching-bracket) no longer hijacks the search query — it now navigates the existing search instead.
|
|
88
|
+
|
|
89
|
+
* **OpenLine (Emacs `C-o`)**: Cursor stays on the original line instead of advancing — was previously indistinguishable from Enter.
|
|
90
|
+
|
|
91
|
+
* **Markdown compose** (#1789, #1790): Wrap budget widened by one column to prevent orphan-word re-wrapping on Windows; current-line highlight now extends across soft-wrapped sub-rows.
|
|
92
|
+
|
|
93
|
+
* **Viewport** (#1794): Popup anchoring counts true visual rows under wrap, so completion popups appear next to the cursor instead of several rows above in heavily-wrapped buffers.
|
|
94
|
+
|
|
95
|
+
### Under the Hood
|
|
96
|
+
|
|
97
|
+
* **Smaller release binaries**: New `dist` cargo profile (`strip=true`, `lto=fat`, `codegen-units=1`, `opt-level=z`) is now applied to release builds. Binary shrinks from 62.4 MB → ~46 MB (-26%). Backtraces are still included in panics.
|
|
98
|
+
|
|
99
|
+
* **Build performance**: `oxc` and `rquickjs` now build at `opt-level=3` in dev/test profiles to keep iteration fast despite their size.
|
|
100
|
+
|
|
101
|
+
* **Semantic test framework + ~250 migrated cases**: A new "scenario" test layer dispatches `Action`s straight against an isolated editor instance, skipping plugin loading where the assertion surface (buffer text + caret) can't observe it — about 440 ms saved per test harness. ~250 e2e claims have been migrated across multicursor, block selection, auto-indent, paste, undo/redo, search-modal flows, multibyte handling, and many regression repros (issues #191, #1147, #1305, #1574, #1697, etc.). Property-based theorems over generated action sequences caught two real production crashes in no-render dispatch paths (vi-mode count prefixes, plugin action batches) — both fixed in this release. A pre-existing race in concurrent embedded-plugin extraction (could leave half-written plugins for parallel test processes) is also fixed.
|
|
102
|
+
|
|
3
103
|
## 0.3.2
|
|
4
104
|
|
|
5
105
|
### Features
|
package/package.json
CHANGED
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
"$ref": "#/$defs/EditorConfig",
|
|
32
32
|
"default": {
|
|
33
33
|
"animations": true,
|
|
34
|
+
"cursor_jump_animation": true,
|
|
34
35
|
"line_numbers": true,
|
|
35
36
|
"relative_line_numbers": false,
|
|
36
37
|
"highlight_current_line": true,
|
|
@@ -247,7 +248,8 @@
|
|
|
247
248
|
"dark",
|
|
248
249
|
"light",
|
|
249
250
|
"high-contrast",
|
|
250
|
-
"nostalgia"
|
|
251
|
+
"nostalgia",
|
|
252
|
+
"terminal"
|
|
251
253
|
]
|
|
252
254
|
},
|
|
253
255
|
"LocaleOptions": {
|
|
@@ -280,6 +282,12 @@
|
|
|
280
282
|
"default": true,
|
|
281
283
|
"x-section": "Display"
|
|
282
284
|
},
|
|
285
|
+
"cursor_jump_animation": {
|
|
286
|
+
"description": "Enable the cursor-jump trail animation on long cursor moves\n(search jumps, go-to-definition, pane switches). Has no effect\nwhen `animations` is `false`.",
|
|
287
|
+
"type": "boolean",
|
|
288
|
+
"default": true,
|
|
289
|
+
"x-section": "Display"
|
|
290
|
+
},
|
|
283
291
|
"line_numbers": {
|
|
284
292
|
"description": "Show line numbers in the gutter (default for new buffers)",
|
|
285
293
|
"type": "boolean",
|
|
@@ -126,6 +126,10 @@ const finder = new Finder<DiagnosticItem>(editor, {
|
|
|
126
126
|
groupBy: "file",
|
|
127
127
|
syncWithEditor: true,
|
|
128
128
|
navigateOnCursorMove: true,
|
|
129
|
+
// Diagnostics is a generic "list of locations" UX — route into
|
|
130
|
+
// the shared Utility Dock so it shares space with Quickfix,
|
|
131
|
+
// search-replace results, etc. See issue #1796.
|
|
132
|
+
useUtilityDock: true,
|
|
129
133
|
onClose: () => {
|
|
130
134
|
isOpen = false;
|
|
131
135
|
sourceBufferId = null;
|
|
@@ -40,6 +40,10 @@ const finder = new Finder<ReferenceLocation>(editor, {
|
|
|
40
40
|
},
|
|
41
41
|
preview: true,
|
|
42
42
|
maxResults: 100,
|
|
43
|
+
// Find References is a generic "list of locations" UX — share
|
|
44
|
+
// the Utility Dock with Diagnostics, Quickfix, search-replace
|
|
45
|
+
// results, etc. See issue #1796.
|
|
46
|
+
useUtilityDock: true,
|
|
43
47
|
});
|
|
44
48
|
|
|
45
49
|
// Pending references for the current prompt
|
package/plugins/git_explorer.ts
CHANGED
|
@@ -117,9 +117,14 @@ async function refreshGitExplorerDecorations() {
|
|
|
117
117
|
return;
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
+
// -z gives NUL-terminated, raw (unquoted) paths. Without it git
|
|
121
|
+
// wraps any path containing spaces or special chars in double
|
|
122
|
+
// quotes (e.g. `?? "name copy.txt"`), which the parser would then
|
|
123
|
+
// key the decoration against — meaning the actual on-disk path
|
|
124
|
+
// never matches and the badge never appears next to the file.
|
|
120
125
|
const statusResult = await editor.spawnProcess(
|
|
121
126
|
"git",
|
|
122
|
-
["status", "--porcelain"],
|
|
127
|
+
["status", "--porcelain", "-z"],
|
|
123
128
|
repoRoot
|
|
124
129
|
);
|
|
125
130
|
if (statusResult.exit_code !== 0) {
|
|
@@ -155,6 +160,9 @@ editor.on("after_file_open", () => {
|
|
|
155
160
|
editor.on("after_file_save", () => {
|
|
156
161
|
refreshGitExplorerDecorations();
|
|
157
162
|
});
|
|
163
|
+
editor.on("after_file_explorer_change", () => {
|
|
164
|
+
refreshGitExplorerDecorations();
|
|
165
|
+
});
|
|
158
166
|
editor.on("editor_initialized", () => {
|
|
159
167
|
refreshGitExplorerDecorations();
|
|
160
168
|
});
|
package/plugins/git_grep.ts
CHANGED
|
@@ -48,8 +48,10 @@ async function searchWithGitGrep(query: string): Promise<GrepMatch[]> {
|
|
|
48
48
|
);
|
|
49
49
|
|
|
50
50
|
if (result.exit_code === 0) {
|
|
51
|
-
return parseGrepOutput(result.stdout, 100) as GrepMatch[];
|
|
51
|
+
return parseGrepOutput(result.stdout, 100, (msg) => editor.debug(msg)) as GrepMatch[];
|
|
52
52
|
}
|
|
53
|
+
editor.error(`[git_grep] process exited with code ${result.exit_code}: ${result.stderr}`);
|
|
54
|
+
editor.setStatus(`git grep failed (exit ${result.exit_code})`);
|
|
53
55
|
return [];
|
|
54
56
|
}
|
|
55
57
|
|
package/plugins/lib/finder.ts
CHANGED
|
@@ -118,6 +118,21 @@ export interface FinderConfig<T> {
|
|
|
118
118
|
|
|
119
119
|
/** Called when the panel or prompt is closed (e.g. via Escape) */
|
|
120
120
|
onClose?: () => void;
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* When true, panels created by this Finder are routed into the
|
|
124
|
+
* shared Utility Dock (issue #1796 / Section 2 of
|
|
125
|
+
* `docs/internal/tui-editor-layout-design.md`). The first
|
|
126
|
+
* dock-aware utility creates the dock leaf; subsequent ones swap
|
|
127
|
+
* the dock's active buffer instead of spawning new splits.
|
|
128
|
+
*
|
|
129
|
+
* Defaults to `false` so panels with bespoke layouts (e.g.
|
|
130
|
+
* `theme_editor`'s buffer groups, `pkg`'s side-by-side panes)
|
|
131
|
+
* keep their independent split. Plugins that present a generic
|
|
132
|
+
* "list of locations" UX (Diagnostics, Find References, Live
|
|
133
|
+
* Grep Quickfix) should opt in.
|
|
134
|
+
*/
|
|
135
|
+
useUtilityDock?: boolean;
|
|
121
136
|
}
|
|
122
137
|
|
|
123
138
|
/**
|
|
@@ -128,6 +143,14 @@ export interface PromptOptions<T> {
|
|
|
128
143
|
source: SearchSource<T> | FilterSource<T>;
|
|
129
144
|
/** Initial query value */
|
|
130
145
|
initialQuery?: string;
|
|
146
|
+
/**
|
|
147
|
+
* Render the prompt as a centred floating overlay with an
|
|
148
|
+
* embedded preview pane (issue #1796). When true, the editor
|
|
149
|
+
* draws the input + results + preview inside one floating frame
|
|
150
|
+
* over the editor area; the underlying split tree is not
|
|
151
|
+
* mutated. Defaults to false.
|
|
152
|
+
*/
|
|
153
|
+
floatingOverlay?: boolean;
|
|
131
154
|
}
|
|
132
155
|
|
|
133
156
|
/**
|
|
@@ -277,7 +300,16 @@ export function defaultFuzzyFilter<T>(
|
|
|
277
300
|
// ============================================================================
|
|
278
301
|
|
|
279
302
|
/**
|
|
280
|
-
* Parse a grep-style output line
|
|
303
|
+
* Parse a grep-style output line.
|
|
304
|
+
*
|
|
305
|
+
* Accepts both `file:line:column:content` (ripgrep, ag, git-grep with
|
|
306
|
+
* `--column`, GNU grep with `--column`) and `file:line:content`
|
|
307
|
+
* (POSIX grep, BSD grep, plenty of custom wrappers that omit the
|
|
308
|
+
* column). When the column is missing it defaults to 1.
|
|
309
|
+
*
|
|
310
|
+
* Returns null only if the line lacks even a `file:line:` prefix —
|
|
311
|
+
* pure header lines (ripgrep without `--no-heading`, blank lines)
|
|
312
|
+
* are filtered upstream by the caller's `if (!line.trim()) continue`.
|
|
281
313
|
*/
|
|
282
314
|
export function parseGrepLine(line: string): {
|
|
283
315
|
file: string;
|
|
@@ -285,13 +317,25 @@ export function parseGrepLine(line: string): {
|
|
|
285
317
|
column: number;
|
|
286
318
|
content: string;
|
|
287
319
|
} | null {
|
|
288
|
-
|
|
289
|
-
|
|
320
|
+
// Try the four-field shape first so a content payload that
|
|
321
|
+
// happens to start with digits (e.g. `42 = solve(...)`) doesn't
|
|
322
|
+
// get mistaken for a column number under the three-field path.
|
|
323
|
+
const four = line.match(/^([^:]+):(\d+):(\d+):(.*)$/);
|
|
324
|
+
if (four) {
|
|
325
|
+
return {
|
|
326
|
+
file: four[1],
|
|
327
|
+
line: parseInt(four[2], 10),
|
|
328
|
+
column: parseInt(four[3], 10),
|
|
329
|
+
content: four[4],
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
const three = line.match(/^([^:]+):(\d+):(.*)$/);
|
|
333
|
+
if (three) {
|
|
290
334
|
return {
|
|
291
|
-
file:
|
|
292
|
-
line: parseInt(
|
|
293
|
-
column:
|
|
294
|
-
content:
|
|
335
|
+
file: three[1],
|
|
336
|
+
line: parseInt(three[2], 10),
|
|
337
|
+
column: 1,
|
|
338
|
+
content: three[3],
|
|
295
339
|
};
|
|
296
340
|
}
|
|
297
341
|
return null;
|
|
@@ -302,7 +346,8 @@ export function parseGrepLine(line: string): {
|
|
|
302
346
|
*/
|
|
303
347
|
export function parseGrepOutput(
|
|
304
348
|
stdout: string,
|
|
305
|
-
maxResults: number = 100
|
|
349
|
+
maxResults: number = 100,
|
|
350
|
+
debug?: (msg: string) => void
|
|
306
351
|
): Array<{ file: string; line: number; column: number; content: string }> {
|
|
307
352
|
const results: Array<{
|
|
308
353
|
file: string;
|
|
@@ -311,14 +356,16 @@ export function parseGrepOutput(
|
|
|
311
356
|
content: string;
|
|
312
357
|
}> = [];
|
|
313
358
|
|
|
314
|
-
for (const line of stdout.split(
|
|
315
|
-
if (!line
|
|
359
|
+
for (const line of stdout.split(/\r?\n/)) {
|
|
360
|
+
if (!line) continue;
|
|
316
361
|
const match = parseGrepLine(line);
|
|
317
362
|
if (match) {
|
|
318
363
|
results.push(match);
|
|
319
364
|
if (results.length >= maxResults) {
|
|
320
365
|
break;
|
|
321
366
|
}
|
|
367
|
+
} else if (debug) {
|
|
368
|
+
debug(`[parseGrepOutput] failed to parse line: ${line}`);
|
|
322
369
|
}
|
|
323
370
|
}
|
|
324
371
|
|
|
@@ -465,20 +512,42 @@ export class Finder<T> {
|
|
|
465
512
|
}
|
|
466
513
|
|
|
467
514
|
// Start the prompt
|
|
515
|
+
const overlay = options.floatingOverlay === true;
|
|
468
516
|
if (options.initialQuery) {
|
|
469
517
|
this.editor.startPromptWithInitial(
|
|
470
518
|
options.title,
|
|
471
519
|
this.config.id,
|
|
472
|
-
options.initialQuery
|
|
520
|
+
options.initialQuery,
|
|
521
|
+
overlay
|
|
473
522
|
);
|
|
474
523
|
} else {
|
|
475
|
-
this.editor.debug(`[Finder] calling startPrompt with title="${options.title}", id="${this.config.id}"`);
|
|
476
|
-
const result = this.editor.startPrompt(options.title, this.config.id);
|
|
524
|
+
this.editor.debug(`[Finder] calling startPrompt with title="${options.title}", id="${this.config.id}", overlay=${overlay}`);
|
|
525
|
+
const result = this.editor.startPrompt(options.title, this.config.id, overlay);
|
|
477
526
|
this.editor.debug(`[Finder] startPrompt returned: ${result}`);
|
|
478
527
|
}
|
|
479
528
|
this.editor.setStatus("Type to search...");
|
|
480
529
|
}
|
|
481
530
|
|
|
531
|
+
/**
|
|
532
|
+
* Re-run the current search against `lastQuery`, bypassing the
|
|
533
|
+
* "skip-if-same-query" dedup. Useful when the *backend* has
|
|
534
|
+
* changed (e.g. user cycled Live Grep providers) and the same
|
|
535
|
+
* query needs to produce different results.
|
|
536
|
+
*
|
|
537
|
+
* No-op for filter-mode sources (results are already correct
|
|
538
|
+
* client-side) and when no prompt is open.
|
|
539
|
+
*/
|
|
540
|
+
async refresh(): Promise<void> {
|
|
541
|
+
if (!this.isPromptMode || !this.currentSource) return;
|
|
542
|
+
if (this.currentSource.mode !== "search") return;
|
|
543
|
+
const query = this.promptState.lastQuery;
|
|
544
|
+
// Reset dedup so runSearch doesn't short-circuit on the
|
|
545
|
+
// unchanged query.
|
|
546
|
+
this.promptState.lastQuery = "";
|
|
547
|
+
if (query.length === 0) return;
|
|
548
|
+
await this.runSearch(query, this.currentSource);
|
|
549
|
+
}
|
|
550
|
+
|
|
482
551
|
/**
|
|
483
552
|
* Show static results in panel
|
|
484
553
|
*/
|
|
@@ -718,7 +787,8 @@ export class Finder<T> {
|
|
|
718
787
|
// Parse as grep output by default
|
|
719
788
|
const parsed = parseGrepOutput(
|
|
720
789
|
result.stdout,
|
|
721
|
-
this.config.maxResults
|
|
790
|
+
this.config.maxResults,
|
|
791
|
+
(msg) => this.editor.debug(msg)
|
|
722
792
|
) as unknown as T[];
|
|
723
793
|
this.updatePromptResults(parsed);
|
|
724
794
|
|
|
@@ -761,9 +831,26 @@ export class Finder<T> {
|
|
|
761
831
|
}
|
|
762
832
|
} catch (e) {
|
|
763
833
|
const errorMsg = String(e);
|
|
764
|
-
|
|
765
|
-
|
|
834
|
+
// "killed" / "not found" come from the cancellation path (a
|
|
835
|
+
// newer search aborted this one). Suppress those entirely —
|
|
836
|
+
// the user didn't ask for them.
|
|
837
|
+
if (errorMsg.includes("killed") || errorMsg.includes("not found")) {
|
|
838
|
+
return;
|
|
766
839
|
}
|
|
840
|
+
// Render the error inside the overlay's result list itself.
|
|
841
|
+
// The status bar is shared and clobbered by other code paths,
|
|
842
|
+
// so it's not a reliable place to surface a feature-scoped
|
|
843
|
+
// error — the overlay is where the user is looking.
|
|
844
|
+
this.promptState.results = [];
|
|
845
|
+
this.promptState.entries = [];
|
|
846
|
+
const display = errorMsg.replace(/^Error:\s*/, "");
|
|
847
|
+
this.editor.setPromptSuggestions([
|
|
848
|
+
{
|
|
849
|
+
text: `⚠ ${display}`,
|
|
850
|
+
value: "",
|
|
851
|
+
disabled: true,
|
|
852
|
+
},
|
|
853
|
+
]);
|
|
767
854
|
}
|
|
768
855
|
}
|
|
769
856
|
|
|
@@ -1095,6 +1182,11 @@ export class Finder<T> {
|
|
|
1095
1182
|
ratio,
|
|
1096
1183
|
direction: "horizontal",
|
|
1097
1184
|
panelId: this.config.id,
|
|
1185
|
+
// Per-finder opt-in via `useUtilityDock` — many Finder
|
|
1186
|
+
// consumers (theme_editor's buffer groups, pkg's side-by-
|
|
1187
|
+
// side panes, …) need their own independent splits and
|
|
1188
|
+
// would break if routed into the shared dock.
|
|
1189
|
+
...(this.config.useUtilityDock ? { role: "utility_dock" } : {}),
|
|
1098
1190
|
showLineNumbers: false,
|
|
1099
1191
|
showCursors: true,
|
|
1100
1192
|
editingDisabled: true,
|
package/plugins/lib/fresh.d.ts
CHANGED
|
@@ -821,6 +821,13 @@ type CreateVirtualBufferInSplitOptions = {
|
|
|
821
821
|
* Initial content entries with optional properties
|
|
822
822
|
*/
|
|
823
823
|
entries?: Array<TextPropertyEntry>;
|
|
824
|
+
/**
|
|
825
|
+
* Split role tag. When set to `"utility_dock"`, the dispatcher
|
|
826
|
+
* routes this buffer to the existing dock leaf if one exists,
|
|
827
|
+
* instead of creating a new split. See
|
|
828
|
+
* `docs/internal/tui-editor-layout-design.md` Section 2.
|
|
829
|
+
*/
|
|
830
|
+
role?: string;
|
|
824
831
|
};
|
|
825
832
|
type CreateVirtualBufferOptions = {
|
|
826
833
|
/**
|
|
@@ -982,6 +989,10 @@ type SpawnResult = {
|
|
|
982
989
|
*/
|
|
983
990
|
exit_code: number;
|
|
984
991
|
};
|
|
992
|
+
type StyledText = {
|
|
993
|
+
text: string;
|
|
994
|
+
style?: Partial<OverlayOptions>;
|
|
995
|
+
};
|
|
985
996
|
type TextPropertiesAtCursor = Array<Record<string, unknown>>;
|
|
986
997
|
type TsHighlightSpan = {
|
|
987
998
|
start: number;
|
|
@@ -1458,6 +1469,11 @@ interface EditorAPI {
|
|
|
1458
1469
|
*/
|
|
1459
1470
|
getBuiltinThemes(): unknown;
|
|
1460
1471
|
/**
|
|
1472
|
+
* Full theme registry (builtins + user themes + packages + bundles).
|
|
1473
|
+
* Keyed by canonical registry key; each value carries `_key` / `_pack`.
|
|
1474
|
+
*/
|
|
1475
|
+
getAllThemes(): unknown;
|
|
1476
|
+
/**
|
|
1461
1477
|
* Delete a custom theme (alias for deleteThemeSync)
|
|
1462
1478
|
*/
|
|
1463
1479
|
deleteTheme(name: string): boolean;
|
|
@@ -1668,9 +1684,15 @@ interface EditorAPI {
|
|
|
1668
1684
|
*/
|
|
1669
1685
|
prompt(label: string, initialValue: string): Promise<string | null>;
|
|
1670
1686
|
/**
|
|
1671
|
-
* Start an interactive prompt
|
|
1687
|
+
* Start an interactive prompt.
|
|
1688
|
+
*
|
|
1689
|
+
* When `floatingOverlay` is true, the editor renders the prompt
|
|
1690
|
+
* and its suggestions inside a centred floating frame instead of
|
|
1691
|
+
* the bottom minibuffer row (issue #1796 — Live Grep). The flag
|
|
1692
|
+
* is rendering-only; confirm/cancel/hooks behave identically to a
|
|
1693
|
+
* non-overlay prompt of the same `promptType`.
|
|
1672
1694
|
*/
|
|
1673
|
-
startPrompt(label: string, promptType: string): boolean;
|
|
1695
|
+
startPrompt(label: string, promptType: string, floatingOverlay?: boolean): boolean;
|
|
1674
1696
|
/**
|
|
1675
1697
|
* Begin a key-capture window for the calling plugin.
|
|
1676
1698
|
*
|
|
@@ -1704,9 +1726,10 @@ interface EditorAPI {
|
|
|
1704
1726
|
*/
|
|
1705
1727
|
getNextKey(): Promise<KeyEventPayload>;
|
|
1706
1728
|
/**
|
|
1707
|
-
* Start a prompt with initial value
|
|
1729
|
+
* Start a prompt with initial value. See `startPrompt` for the
|
|
1730
|
+
* meaning of `floatingOverlay`.
|
|
1708
1731
|
*/
|
|
1709
|
-
startPromptWithInitial(label: string, promptType: string, initialValue: string): boolean;
|
|
1732
|
+
startPromptWithInitial(label: string, promptType: string, initialValue: string, floatingOverlay?: boolean): boolean;
|
|
1710
1733
|
/**
|
|
1711
1734
|
* Set suggestions for the current prompt
|
|
1712
1735
|
*
|
|
@@ -1715,6 +1738,18 @@ interface EditorAPI {
|
|
|
1715
1738
|
setPromptSuggestions(suggestions: PromptSuggestion[]): boolean;
|
|
1716
1739
|
setPromptInputSync(sync: boolean): boolean;
|
|
1717
1740
|
/**
|
|
1741
|
+
* Set the title shown in the floating-overlay prompt's frame
|
|
1742
|
+
* header (issue #1796) as styled segments. Each segment
|
|
1743
|
+
* carries optional `Partial<OverlayOptions>`, the same
|
|
1744
|
+
* styling primitive used by virtual text — plugins mark
|
|
1745
|
+
* keybinding hints with `{ fg: "ui.help_key_fg" }`,
|
|
1746
|
+
* separators with `{ fg: "ui.popup_border_fg" }`, etc. Pass
|
|
1747
|
+
* an empty array to clear the title and fall back to the
|
|
1748
|
+
* prompt-type default. Has no visible effect on non-overlay
|
|
1749
|
+
* prompts.
|
|
1750
|
+
*/
|
|
1751
|
+
setPromptTitle(title: StyledText[]): boolean;
|
|
1752
|
+
/**
|
|
1718
1753
|
* Define a buffer mode (takes bindings as array of [key, command] pairs)
|
|
1719
1754
|
*/
|
|
1720
1755
|
defineMode(name: string, bindingsArr: string[][], readOnly?: boolean, allowTextInput?: boolean, inheritNormalBindings?: boolean): boolean;
|
|
@@ -2099,6 +2134,16 @@ interface HookEventMap {
|
|
|
2099
2134
|
path: string;
|
|
2100
2135
|
buffer_id: number;
|
|
2101
2136
|
};
|
|
2137
|
+
/**
|
|
2138
|
+
* Fired by the file explorer after a paste/duplicate/etc. mutates
|
|
2139
|
+
* the filesystem without going through a buffer save. Plugins that
|
|
2140
|
+
* surface FS-derived state (git status badges, etc.) should
|
|
2141
|
+
* subscribe in addition to `after_file_save` to refresh on
|
|
2142
|
+
* explorer-driven changes too.
|
|
2143
|
+
*/
|
|
2144
|
+
after_file_explorer_change: {
|
|
2145
|
+
path: string;
|
|
2146
|
+
};
|
|
2102
2147
|
// ── text edits ───────────────────────────────────────────────────────────
|
|
2103
2148
|
before_insert: {
|
|
2104
2149
|
buffer_id: number;
|