Skip to content

Commit f3d099b

Browse files
committed
feat: default selected to currently active tabs
1 parent 3390ac9 commit f3d099b

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/main.rs

+12-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ impl Default for State {
1414
Self {
1515
tabs: Vec::default(),
1616
filter: String::default(),
17-
selected: Some(0),
17+
selected: None,
1818
ignore_case: false,
1919
}
2020
}
@@ -122,6 +122,17 @@ impl ZellijPlugin for State {
122122
let mut should_render = false;
123123
match event {
124124
Event::TabUpdate(tab_info) => {
125+
self.selected =
126+
tab_info.iter().find_map(
127+
|tab| {
128+
if tab.active {
129+
Some(tab.position)
130+
} else {
131+
None
132+
}
133+
},
134+
);
135+
125136
self.tabs = tab_info;
126137
should_render = true;
127138
}

0 commit comments

Comments
 (0)