File tree Expand file tree Collapse file tree 3 files changed +17
-7
lines changed Expand file tree Collapse file tree 3 files changed +17
-7
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
7
7
## [ Unreleased]
8
8
9
+ ### Added
10
+ - support reverse tabbing using shift+tab ([ #92 ] ( https://github.com/extrawurst/gitui/issues/92 ) )
11
+
9
12
## [ 0.4.0] - 2020-05-25
10
13
11
14
### Added
Original file line number Diff line number Diff line change @@ -128,7 +128,11 @@ impl App {
128
128
} else if let Event :: Key ( k) = ev {
129
129
let new_flags = match k {
130
130
keys:: TAB_TOGGLE => {
131
- self . toggle_tabs ( ) ?;
131
+ self . toggle_tabs ( false ) ?;
132
+ NeedsUpdate :: COMMANDS
133
+ }
134
+ keys:: TAB_TOGGLE_REVERSE => {
135
+ self . toggle_tabs ( true ) ?;
132
136
NeedsUpdate :: COMMANDS
133
137
}
134
138
@@ -235,12 +239,14 @@ impl App {
235
239
]
236
240
}
237
241
238
- fn toggle_tabs ( & mut self ) -> Result < ( ) > {
239
- let mut new_tab = self . tab + 1 ;
240
- {
241
- let tabs = self . get_tabs ( ) ;
242
- new_tab %= tabs. len ( ) ;
243
- }
242
+ fn toggle_tabs ( & mut self , reverse : bool ) -> Result < ( ) > {
243
+ let tabs_len = self . get_tabs ( ) . len ( ) ;
244
+ let new_tab = if reverse {
245
+ self . tab . wrapping_sub ( 1 ) . min ( tabs_len. saturating_sub ( 1 ) )
246
+ } else {
247
+ self . tab . saturating_add ( 1 ) % tabs_len
248
+ } ;
249
+
244
250
self . set_tab ( new_tab)
245
251
}
246
252
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ const fn with_mod(
15
15
}
16
16
17
17
pub const TAB_TOGGLE : KeyEvent = no_mod ( KeyCode :: Tab ) ;
18
+ pub const TAB_TOGGLE_REVERSE : KeyEvent = no_mod ( KeyCode :: BackTab ) ;
18
19
pub const FOCUS_WORKDIR : KeyEvent = no_mod ( KeyCode :: Char ( '1' ) ) ;
19
20
pub const FOCUS_STAGE : KeyEvent = no_mod ( KeyCode :: Char ( '2' ) ) ;
20
21
pub const FOCUS_RIGHT : KeyEvent = no_mod ( KeyCode :: Right ) ;
You can’t perform that action at this time.
0 commit comments