style: anchor command and search input bottom-left

This commit is contained in:
Valdemar Lorenzen
2026-10-12 13:33:41 +02:00
parent 7bc5eab22f
commit 406f45c6fb
2 changed files with 8 additions and 11 deletions
+1 -1
View File
@@ -142,7 +142,7 @@ Submitting an empty search repeats the last query. Esc cancels without moving th
## Commands, saving, and pasted input ## Commands, saving, and pasted input
`:` opens compact floating command input titled **Command**; `/` opens input titled **Search** for buffer text search. Titles sit at the top-left border, replacing the displayed leading `:` / `/`. Both input fields have one column of padding on each side. Enter submits and Escape cancels using the existing modal rules. Long Unicode input scrolls horizontally without changing buffer text. Input is bounded by the workspace, above configured bars, and temporarily hides operation notifications; there is no permanent prompt/footer row. Tiny windows omit borders/titles or padding when needed to keep input usable. `:` opens compact floating command input titled **Command**; `/` opens input titled **Search** for buffer text search. Titles sit at the top-left border, replacing the displayed leading `:` / `/`. Both input fields have one column of padding on each side. Enter submits and Escape cancels using the existing modal rules. Long Unicode input scrolls horizontally without changing buffer text. Input anchors to the workspace's bottom-left edge, directly above the bottom bar when visible, and temporarily hides operation notifications; there is no permanent prompt/footer row. Tiny windows omit borders/titles or padding when needed to keep input usable.
The latest reported operation result appears in a non-focusable popup at the workspace's bottom-right, just above the bottom bar when visible, with one column of inner padding on each side when space permits. It remains until dismissed or replaced, with no timer. In Normal mode, the first Escape dismisses it without collapsing carets; a subsequent Escape retains ordinary Normal behavior. Existing modal windows, focused explorers/diff selectors, and pending prefixes retain Escape priority. New operation messages reopen the popup; routine successful buffer switches do not duplicate the buffer/path information already shown in the bar. The latest reported operation result appears in a non-focusable popup at the workspace's bottom-right, just above the bottom bar when visible, with one column of inner padding on each side when space permits. It remains until dismissed or replaced, with no timer. In Normal mode, the first Escape dismisses it without collapsing carets; a subsequent Escape retains ordinary Normal behavior. Existing modal windows, focused explorers/diff selectors, and pending prefixes retain Escape priority. New operation messages reopen the popup; routine successful buffer switches do not duplicate the buffer/path information already shown in the bar.
+7 -10
View File
@@ -1838,15 +1838,9 @@ fn draw_floating_input(frame: &mut Frame, editor: &Editor, area: Rect) -> Option
if area.width == 0 || area.height == 0 { if area.width == 0 || area.height == 0 {
return None; return None;
} }
let panel = floating_panel(area); let width = area.width.min(72);
let width = panel.width.min(72); let height = area.height.min(3);
let height = panel.height.min(3); let panel = Rect::new(area.x, area.bottom() - height, width, height);
let panel = Rect::new(
panel.x + (panel.width - width) / 2,
panel.y + (panel.height - height) / 2,
width,
height,
);
let bordered = panel.width >= 4 && panel.height >= 3; let bordered = panel.width >= 4 && panel.height >= 3;
let padding = u16::from(panel.width.saturating_sub(2 * u16::from(bordered)) >= 3); let padding = u16::from(panel.width.saturating_sub(2 * u16::from(bordered)) >= 3);
let mut block = Block::default() let mut block = Block::default()
@@ -5598,12 +5592,15 @@ mod tests {
editor.handle(Input::Char(ch)); editor.handle(Input::Char(ch));
} }
let mut terminal = Terminal::new(ratatui::backend::TestBackend::new(80, 12)).unwrap(); let mut terminal = Terminal::new(ratatui::backend::TestBackend::new(80, 12)).unwrap();
let workspace = Rect::new(3, 2, 74, 8);
let mut panel = Rect::default(); let mut panel = Rect::default();
terminal terminal
.draw(|frame| { .draw(|frame| {
panel = draw_floating_input(frame, &editor, frame.area()).unwrap(); panel = draw_floating_input(frame, &editor, workspace).unwrap();
}) })
.unwrap(); .unwrap();
assert_eq!(panel.x, workspace.x);
assert_eq!(panel.bottom(), workspace.bottom());
assert!( assert!(
pane_screen(&terminal, Rect::new(panel.x, panel.y, panel.width, 1)).contains(title) pane_screen(&terminal, Rect::new(panel.x, panel.y, panel.width, 1)).contains(title)
); );