Pass application context to GUI. #11

Merged
shaunrd0 merged 9 commits from app-context into main 2026-01-31 04:25:16 +00:00
2 changed files with 7 additions and 20 deletions
Showing only changes of commit b607a6daaa - Show all commits

View File

@ -43,7 +43,7 @@ impl<'a> App<'a> {
pub fn new(root_path: PathBuf) -> Result<Self> {
trace!(target:Self::ID, "Building {}", Self::ID);
let app = Self {
editor_tab: EditorTab::new(None),
editor_tab: EditorTab::new(),
explorer: Explorer::new(&root_path)?,
logger: Logger::new(),
menu_bar: MenuBar::new(),

View File

@ -21,25 +21,12 @@ pub struct EditorTab {
impl EditorTab {
pub const ID: &str = "EditorTab";
pub fn new(path: Option<&std::path::PathBuf>) -> Self {
trace!(target:Self::ID, "Building EditorTab with path {path:?}");
match path {
None => Self {
pub fn new() -> Self {
trace!(target:Self::ID, "Building {}", Self::ID);
Self {
editors: HashMap::new(),
tab_order: Vec::new(),
current_editor: 0,
},
Some(path) => {
let tab_order = vec![path.to_string_lossy().to_string()];
Self {
editors: HashMap::from([(
tab_order.first().unwrap().to_owned(),
Editor::new(path),
)]),
tab_order,
current_editor: 0,
}
}
}
}