Add saved split view rows
This commit is contained in:
@@ -37,12 +37,14 @@ pub struct SplitLayout {
|
||||
id: SplitId,
|
||||
axis: SplitAxis,
|
||||
panes: Vec<SplitPane>,
|
||||
title: String,
|
||||
saved: bool,
|
||||
}
|
||||
|
||||
impl SplitLayout {
|
||||
#[must_use]
|
||||
pub fn new(axis: SplitAxis, panes: Vec<SplitPane>) -> Self {
|
||||
Self { id: SplitId::new(), axis, panes }
|
||||
Self { id: SplitId::new(), axis, panes, title: "Split View".to_string(), saved: false }
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
@@ -60,6 +62,16 @@ impl SplitLayout {
|
||||
&self.panes
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn title(&self) -> &str {
|
||||
&self.title
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn saved(&self) -> bool {
|
||||
self.saved
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn contains_tab(&self, tab_id: &TabId) -> bool {
|
||||
self.panes.iter().any(|pane| pane.tab_id() == tab_id)
|
||||
@@ -84,4 +96,9 @@ impl SplitLayout {
|
||||
self.panes.retain(|pane| pane.tab_id() != tab_id);
|
||||
self.panes.len() != original_len
|
||||
}
|
||||
|
||||
pub fn save(&mut self, title: impl Into<String>) {
|
||||
self.title = title.into();
|
||||
self.saved = true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user