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
+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 {
return None;
}
let panel = floating_panel(area);
let width = panel.width.min(72);
let height = panel.height.min(3);
let panel = Rect::new(
panel.x + (panel.width - width) / 2,
panel.y + (panel.height - height) / 2,
width,
height,
);
let width = area.width.min(72);
let height = area.height.min(3);
let panel = Rect::new(area.x, area.bottom() - height, width, height);
let bordered = panel.width >= 4 && panel.height >= 3;
let padding = u16::from(panel.width.saturating_sub(2 * u16::from(bordered)) >= 3);
let mut block = Block::default()
@@ -5598,12 +5592,15 @@ mod tests {
editor.handle(Input::Char(ch));
}
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();
terminal
.draw(|frame| {
panel = draw_floating_input(frame, &editor, frame.area()).unwrap();
panel = draw_floating_input(frame, &editor, workspace).unwrap();
})
.unwrap();
assert_eq!(panel.x, workspace.x);
assert_eq!(panel.bottom(), workspace.bottom());
assert!(
pane_screen(&terminal, Rect::new(panel.x, panel.y, panel.width, 1)).contains(title)
);