[tui] Add more logging.

This commit is contained in:
2026-01-25 09:07:41 -05:00
parent 711f92b7dd
commit 01eeb9f0ac
8 changed files with 54 additions and 18 deletions

View File

@@ -2,6 +2,7 @@ use crate::tui::component::{Action, Component, ComponentState};
use crate::tui::menu_bar::MenuBarItemOption::{
About, Exit, Reload, Save, ShowHideExplorer, ShowHideLogger,
};
use log::trace;
use ratatui::buffer::Buffer;
use ratatui::crossterm::event::{KeyCode, KeyEvent};
use ratatui::layout::Rect;
@@ -80,8 +81,13 @@ pub struct MenuBar {
}
impl MenuBar {
pub fn id() -> &'static str {
"MenuBar"
}
const DEFAULT_HELP: &str = "(←/h)/(→/l): Select option | Enter: Choose selection";
pub fn new() -> Self {
trace!(target:Self::id(), "Building {}", Self::id());
Self {
selected: MenuBarItem::File,
opened: None,
@@ -136,12 +142,14 @@ impl MenuBar {
fn rect_under_option(anchor: Rect, area: Rect, width: u16, height: u16) -> Rect {
// TODO: X offset for item option? It's fine as-is, but it might look nicer.
Rect {
let rect = Rect {
x: anchor.x,
y: anchor.y + anchor.height,
width: width.min(area.width),
height,
}
};
trace!(target:Self::id(), "Building Rect under MenuBar popup {}", rect);
rect
}
}