[tui] Set tab title to file name.

Also update to use anyhow::Result in some places.
This commit is contained in:
2026-01-20 12:00:24 -05:00
parent bccc5a35e2
commit d2846e1e4e
3 changed files with 14 additions and 8 deletions

View File

@@ -65,8 +65,16 @@ impl<'a> App<'a> {
}
fn draw_tabs(&self, area: Rect, buf: &mut Buffer) {
// TODO: Tabs should be opened from file explorer
Tabs::new(["file.md", "file.cpp"])
// Determine the tab title from the current file (or use a fallback).
let title = self
.editor
.file_path
.as_ref()
.and_then(|p| p.file_name())
.and_then(|s| s.to_str())
.unwrap_or("Untitled");
Tabs::new(vec![title])
.divider(symbols::DOT)
.block(
Block::default()