[tui] Set tab title to file name.
Also update to use anyhow::Result in some places.
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user