fix: tab selection by left click in compact-bar (#1485)

This commit is contained in:
amaihoefner 2022-06-11 20:43:36 +02:00 committed by GitHub
parent 0e897ba156
commit b19e3d9d14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -115,11 +115,11 @@ impl ZellijPlugin for State {
if self.should_render if self.should_render
&& self.mouse_click_pos > len_cnt && self.mouse_click_pos > len_cnt
&& self.mouse_click_pos <= len_cnt + bar_part.len && self.mouse_click_pos <= len_cnt + bar_part.len
&& idx > 2 && idx > 3
{ {
// First three elements of tab_line are "Zellij", session name and empty thing, hence the idx > 2 condition. // First three elements of tab_line are "Zellij", session name and mode, hence the idx > 3 condition.
// Tabs are indexed starting from 1, therefore we need subtract 2 below. // Tabs are indexed starting from 1, therefore we need subtract 3 below.
switch_tab_to(TryInto::<u32>::try_into(idx).unwrap() - 2); switch_tab_to(TryInto::<u32>::try_into(idx).unwrap() - 3);
} }
len_cnt += bar_part.len; len_cnt += bar_part.len;
} }