aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSagittarius-a <sagittarius-a@users.noreply.github.com>2021-07-23 01:32:32 +0200
committerSagittarius-a <sagittarius-a@users.noreply.github.com>2021-08-03 21:12:19 +0200
commit734636637dc7446bc8d453b1ba989139dd70b5fa (patch)
tree1564b527cda64f1b010dde40cf2c281dcc3c88f9
parentfeat(tab): add keybind to go to last tab visited (diff)
downloadsl0ppij-734636637dc7446bc8d453b1ba989139dd70b5fa.tar.gz
sl0ppij-734636637dc7446bc8d453b1ba989139dd70b5fa.tar.xz
sl0ppij-734636637dc7446bc8d453b1ba989139dd70b5fa.zip
fix: rename variable as stated in pull request
-rw-r--r--zellij-server/src/route.rs2
-rw-r--r--zellij-server/src/screen.rs26
-rw-r--r--zellij-utils/src/errors.rs2
3 files changed, 15 insertions, 15 deletions
diff --git a/zellij-server/src/route.rs b/zellij-server/src/route.rs
index 94c4cb2c..7092f3e9 100644
--- a/zellij-server/src/route.rs
+++ b/zellij-server/src/route.rs
@@ -27,7 +27,7 @@ fn route_action(
Action::GoToLastTab => {
session
.senders
- .send_to_screen(ScreenInstruction::GoToLastTab)
+ .send_to_screen(ScreenInstruction::ToggleTab)
.unwrap();
}
Action::Write(val) => {
diff --git a/zellij-server/src/screen.rs b/zellij-server/src/screen.rs
index 02abfc1b..bbba69d9 100644
--- a/zellij-server/src/screen.rs
+++ b/zellij-server/src/screen.rs
@@ -68,7 +68,7 @@ pub(crate) enum ScreenInstruction {
ToggleActiveSyncTab,
CloseTab,
GoToTab(u32),
- GoToLastTab,
+ ToggleTab,
UpdateTabName(Vec<u8>),
TerminalResize(PositionAndSize),
ChangeMode(ModeInfo),
@@ -134,7 +134,7 @@ impl From<&ScreenInstruction> for ScreenContext {
ScreenInstruction::MouseRelease(_) => ScreenContext::MouseRelease,
ScreenInstruction::MouseHold(_) => ScreenContext::MouseHold,
ScreenInstruction::Copy => ScreenContext::Copy,
- ScreenInstruction::GoToLastTab => ScreenContext::GoToLastTab,
+ ScreenInstruction::ToggleTab => ScreenContext::ToggleTab,
}
}
}
@@ -152,7 +152,7 @@ pub(crate) struct Screen {
position_and_size: PositionAndSize,
/// The index of this [`Screen`]'s active [`Tab`].
active_tab_index: Option<usize>,
- last_active_tab_index: Option<usize>,
+ previous_active_tab_index: Option<usize>,
mode_info: ModeInfo,
colors: Palette,
session_state: Arc<RwLock<SessionState>>,
@@ -173,7 +173,7 @@ impl Screen {
position_and_size: client_attributes.position_and_size,
colors: client_attributes.palette,
active_tab_index: None,
- last_active_tab_index: None,
+ previous_active_tab_index: None,
tabs: BTreeMap::new(),
mode_info,
session_state,
@@ -198,7 +198,7 @@ impl Screen {
self.colors,
self.session_state.clone(),
);
- self.last_active_tab_index = self.active_tab_index;
+ self.previous_active_tab_index = self.active_tab_index;
self.active_tab_index = Some(tab_index);
self.tabs.insert(tab_index, tab);
self.update_tabs();
@@ -224,7 +224,7 @@ impl Screen {
for tab in self.tabs.values_mut() {
if tab.position == new_tab_pos {
tab.set_force_render();
- self.last_active_tab_index = self.active_tab_index;
+ self.previous_active_tab_index = self.active_tab_index;
self.active_tab_index = Some(tab.index);
break;
}
@@ -244,7 +244,7 @@ impl Screen {
for tab in self.tabs.values_mut() {
if tab.position == new_tab_pos {
tab.set_force_render();
- self.last_active_tab_index = self.active_tab_index;
+ self.previous_active_tab_index = self.active_tab_index;
self.active_tab_index = Some(tab.index);
break;
}
@@ -259,7 +259,7 @@ impl Screen {
if let Some(t) = self.tabs.values_mut().find(|t| t.position == tab_index) {
if t.index != active_tab_index {
t.set_force_render();
- self.last_active_tab_index = self.active_tab_index;
+ self.previous_active_tab_index = self.active_tab_index;
self.active_tab_index = Some(t.index);
self.update_tabs();
self.render();
@@ -285,7 +285,7 @@ impl Screen {
.unwrap();
if self.tabs.is_empty() {
self.active_tab_index = None;
- self.last_active_tab_index = None;
+ self.previous_active_tab_index = None;
if *self.session_state.read().unwrap() == SessionState::Attached {
self.bus
.senders
@@ -370,7 +370,7 @@ impl Screen {
self.session_state.clone(),
);
tab.apply_layout(layout, new_pids, tab_index);
- self.last_active_tab_index = self.active_tab_index;
+ self.previous_active_tab_index = self.active_tab_index;
self.active_tab_index = Some(tab_index);
self.tabs.insert(tab_index, tab);
self.update_tabs();
@@ -429,10 +429,10 @@ impl Screen {
}
pub fn go_to_last_tab(&mut self) {
let active_tab_index = self.active_tab_index.unwrap();
- if let Some(i) = self.last_active_tab_index {
+ if let Some(i) = self.previous_active_tab_index {
self.go_to_tab(i + 1);
}
- self.last_active_tab_index = Some(active_tab_index);
+ self.previous_active_tab_index = Some(active_tab_index);
self.update_tabs();
self.render();
}
@@ -770,7 +770,7 @@ pub(crate) fn screen_thread_main(
ScreenInstruction::Exit => {
break;
}
- ScreenInstruction::GoToLastTab => {
+ ScreenInstruction::ToggleTab => {
screen.go_to_last_tab();
screen
.bus
diff --git a/zellij-utils/src/errors.rs b/zellij-utils/src/errors.rs
index e215a500..e94e43c5 100644
--- a/zellij-utils/src/errors.rs
+++ b/zellij-utils/src/errors.rs
@@ -227,7 +227,7 @@ pub enum ScreenContext {
MouseRelease,
MouseHold,
Copy,
- GoToLastTab,
+ ToggleTab,
}
/// Stack call representations corresponding to the different types of [`PtyInstruction`]s.