diff --git a/TODO.md b/TODO.md index 96c4cd7..47ffb9d 100644 --- a/TODO.md +++ b/TODO.md @@ -32,7 +32,7 @@ - [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. - [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. - 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. diff --git a/docs/editing.md b/docs/editing.md index c7937b4..4ac3274 100644 --- a/docs/editing.md +++ b/docs/editing.md @@ -278,7 +278,7 @@ Each buffer retains its shared text, path, saved state, and undo/redo history. V | Command | Behavior | | --- | --- | | `: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_next` / `:buffer_previous` | Switch in ascending-ID order, wrapping at either end | | `: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. -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. diff --git a/src/tui.rs b/src/tui.rs index ef75662..7b0af6d 100644 --- a/src/tui.rs +++ b/src/tui.rs @@ -4458,19 +4458,16 @@ fn draw_palette( } else { " " }), + Span::raw(format!("{:>id_width$} ", buffer.id)), Span::styled( - format!("{:>id_width$} ", buffer.id), - Style::default().fg(Color::DarkGray), - ), - Span::styled( - if buffer.active { "%" } else { " " }, + if buffer.active { "●" } else { " " }, Style::default().fg(Color::Cyan), ), Span::styled( if buffer.dirty { "+ " } else { " " }, Style::default().fg(Color::Yellow), ), - Span::raw(&entry.label), + Span::raw(display_path(std::path::Path::new(&entry.label))), ]) .style(style), ); @@ -14495,12 +14492,19 @@ end if width >= 32 { let buffer = terminal.backend().buffer(); 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(); 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)].fg, Color::Yellow); 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!( pane_screen(&terminal, Rect::new(area.x, selected_y, width, 1)) .contains("picker-12.txt")