Skip to content

Commit

Permalink
fix: rename variable as stated in pull request
Browse files Browse the repository at this point in the history
  • Loading branch information
sagittarius-a committed Jul 23, 2021
1 parent f361966 commit 03ccd72
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion zellij-server/src/route.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
26 changes: 13 additions & 13 deletions zellij-server/src/screen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ pub(crate) enum ScreenInstruction {
ToggleActiveSyncTab,
CloseTab,
GoToTab(u32),
GoToLastTab,
ToggleTab,
UpdateTabName(Vec<u8>),
TerminalResize(PositionAndSize),
ChangeMode(ModeInfo),
Expand Down Expand Up @@ -132,7 +132,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,
}
}
}
Expand All @@ -150,7 +150,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>>,
Expand All @@ -171,7 +171,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,
Expand All @@ -196,7 +196,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();
Expand All @@ -222,7 +222,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;
}
Expand All @@ -242,7 +242,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;
}
Expand All @@ -257,7 +257,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();
Expand All @@ -283,7 +283,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
Expand Down Expand Up @@ -363,7 +363,7 @@ impl Screen {
self.session_state.clone(),
);
tab.apply_layout(layout, new_pids);
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();
Expand Down Expand Up @@ -422,10 +422,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();
}
Expand Down Expand Up @@ -733,7 +733,7 @@ pub(crate) fn screen_thread_main(
ScreenInstruction::Exit => {
break;
}
ScreenInstruction::GoToLastTab => {
ScreenInstruction::ToggleTab => {
screen.go_to_last_tab();
screen
.bus
Expand Down
2 changes: 1 addition & 1 deletion zellij-utils/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ pub enum ScreenContext {
MouseRelease,
MouseHold,
Copy,
GoToLastTab,
ToggleTab,
}

/// Stack call representations corresponding to the different types of [`PtyInstruction`]s.
Expand Down

0 comments on commit 03ccd72

Please sign in to comment.