fix: refine buffer picker markers and paths

This commit is contained in:
2026-10-13 16:27:22 +02:00
parent 9d6a0eaeca
commit 0eec3fc3b9
3 changed files with 14 additions and 10 deletions
+1 -1
View File
@@ -32,7 +32,7 @@
- [x] buffer picker (with search). - [x] buffer picker (with search).
- `:buffers` / Space b l opens a searchable picker; shared selection bindings, stable IDs, dirty/active marks, cross-tab buffers, and cancellation without switching. - `:buffers` / Space b l opens a searchable picker; shared selection bindings, stable IDs, dirty/active marks, cross-tab buffers, and cancellation without switching.
- [x] improve buffer picker and align with the rest of the editor ui/design language. - [x] improve buffer picker and align with the rest of the editor ui/design language.
- shared floating-panel geometry, cyan border, padded search, aligned IDs/status columns, colored active/dirty marks, blue selection, and dimmed controls; preserve tiny-terminal navigation and switching. - shared floating-panel geometry, cyan border, padded search, aligned normal-brightness IDs/status columns, cyan `●` active/yellow `+` dirty marks, home-abbreviated paths, blue selection, and dimmed controls; preserve tiny-terminal navigation and switching.
- [ ] sandboxed, revision-specific LSP analysis for historical diff states and historical tabs. - [ ] sandboxed, revision-specific LSP analysis for historical diff states and historical tabs.
- current limitation: immutable snapshot buffers still use the live repository as their LSP workspace; cross-file analysis can mix historical text with current disk contents. - current limitation: immutable snapshot buffers still use the live repository as their LSP workspace; cross-file analysis can mix historical text with current disk contents.
- lazily materialize the complete selected revision, including unchanged files, manifests, and project configuration; run a separate LSP instance rooted in that snapshot. - lazily materialize the complete selected revision, including unchanged files, manifests, and project configuration; run a separate LSP instance rooted in that snapshot.
+2 -2
View File
@@ -278,7 +278,7 @@ Each buffer retains its shared text, path, saved state, and undo/redo history. V
| Command | Behavior | | Command | Behavior |
| --- | --- | | --- | --- |
| `:edit PATH` | Switch to an already-loaded file, or read and validate a new buffer; a nonexistent file opens empty | | `:edit PATH` | Switch to an already-loaded file, or read and validate a new buffer; a nonexistent file opens empty |
| `:buffers` | Open the searchable buffer picker; stable IDs and paths, `%` active, `+` dirty | | `:buffers` | Open the searchable buffer picker; stable IDs and paths, `●` active, `+` dirty |
| `:buffer N` | Switch to buffer ID `N` | | `:buffer N` | Switch to buffer ID `N` |
| `:buffer_next` / `:buffer_previous` | Switch in ascending-ID order, wrapping at either end | | `:buffer_next` / `:buffer_previous` | Switch in ascending-ID order, wrapping at either end |
| `:buffer_delete [N]` | Close the active or named buffer; refuse unsaved changes | | `:buffer_delete [N]` | Close the active or named buffer; refuse unsaved changes |
@@ -290,7 +290,7 @@ Switching from Insert commits its pending undo group and parks that view in Norm
**Space b l**, `:buffers`, or the **Buffers** command-palette action opens the picker. Type to filter IDs and paths with case-insensitive, whitespace-separated substring tokens; every token must match. Results retain ascending ID order. Ctrl+j/Ctrl+n/Down and Ctrl+k/Up select with wraparound, using the shared Selection bindings and overrides. Backspace edits the query; Ctrl+u clears it. Enter switches only the focused pane to the selected buffer without saving or discarding edits; no matches leave the picker open. Esc or Ctrl+p cancels without switching. Printable keys, including `:` and leader keys, belong to the query. **Space b l**, `:buffers`, or the **Buffers** command-palette action opens the picker. Type to filter IDs and paths with case-insensitive, whitespace-separated substring tokens; every token must match. Results retain ascending ID order. Ctrl+j/Ctrl+n/Down and Ctrl+k/Up select with wraparound, using the shared Selection bindings and overrides. Backspace edits the query; Ctrl+u clears it. Enter switches only the focused pane to the selected buffer without saving or discarding edits; no matches leave the picker open. Esc or Ctrl+p cancels without switching. Printable keys, including `:` and leader keys, belong to the query.
The picker uses the file explorer's centered floating-panel geometry, a cyan border, padded search input, and dimmed controls. Buffer IDs and status columns align across rows: `%` is cyan for the active buffer, `+` is yellow for unsaved changes, and the selected row is blue. Narrow or short terminals drop padding/borders as needed while keeping the query cursor and selected result visible whenever a result row fits. The picker uses the file explorer's centered floating-panel geometry, a cyan border, padded search input, and dimmed controls. Buffer IDs and status columns align across rows: IDs use the normal text foreground, `●` is cyan for the active buffer, `+` is yellow for unsaved changes, and the selected row is blue. Paths under the home directory display as `~/…`, using the same component-aware abbreviation as the status bar; searching and file operations retain the original paths. Narrow or short terminals drop padding/borders as needed while keeping the query cursor and selected result visible whenever a result row fits.
The picker includes ordinary buffers from every tab and unnamed buffers as `[No Name]`; immutable diff snapshots are excluded. Labels sanitize path control characters, but selection uses stable buffer IDs, so displayed-name collisions still select the correct buffer. Switching out of a diff follows ordinary `:buffer N` behavior. The picker includes ordinary buffers from every tab and unnamed buffers as `[No Name]`; immutable diff snapshots are excluded. Labels sanitize path control characters, but selection uses stable buffer IDs, so displayed-name collisions still select the correct buffer. Switching out of a diff follows ordinary `:buffer N` behavior.
+11 -7
View File
@@ -4458,19 +4458,16 @@ fn draw_palette(
} else { } else {
" " " "
}), }),
Span::raw(format!("{:>id_width$} ", buffer.id)),
Span::styled( Span::styled(
format!("{:>id_width$} ", buffer.id), if buffer.active { "●" } else { " " },
Style::default().fg(Color::DarkGray),
),
Span::styled(
if buffer.active { "%" } else { " " },
Style::default().fg(Color::Cyan), Style::default().fg(Color::Cyan),
), ),
Span::styled( Span::styled(
if buffer.dirty { "+ " } else { " " }, if buffer.dirty { "+ " } else { " " },
Style::default().fg(Color::Yellow), Style::default().fg(Color::Yellow),
), ),
Span::raw(&entry.label), Span::raw(display_path(std::path::Path::new(&entry.label))),
]) ])
.style(style), .style(style),
); );
@@ -14495,12 +14492,19 @@ end
if width >= 32 { if width >= 32 {
let buffer = terminal.backend().buffer(); let buffer = terminal.backend().buffer();
let selected_y = (area.y..area.bottom()) let selected_y = (area.y..area.bottom())
.find(|&y| buffer[(area.x + 7, y)].symbol() == "%") .find(|&y| {
pane_screen(&terminal, Rect::new(area.x, y, width, 1))
.contains("picker-12.txt")
})
.unwrap(); .unwrap();
assert_eq!(buffer[(area.x + 7, selected_y)].fg, Color::Cyan); assert_eq!(buffer[(area.x + 7, selected_y)].fg, Color::Cyan);
assert_eq!(buffer[(area.x + 8, selected_y)].symbol(), "+"); assert_eq!(buffer[(area.x + 8, selected_y)].symbol(), "+");
assert_eq!(buffer[(area.x + 8, selected_y)].fg, Color::Yellow); assert_eq!(buffer[(area.x + 8, selected_y)].fg, Color::Yellow);
assert_eq!(buffer[(area.x + 10, selected_y)].bg, Color::Blue); assert_eq!(buffer[(area.x + 10, selected_y)].bg, Color::Blue);
assert_eq!(
buffer[(area.x + 4, selected_y)].fg,
buffer[(area.x + 10, selected_y)].fg,
);
assert!( assert!(
pane_screen(&terminal, Rect::new(area.x, selected_y, width, 1)) pane_screen(&terminal, Rect::new(area.x, selected_y, width, 1))
.contains("picker-12.txt") .contains("picker-12.txt")