File tree 3 files changed +18
-6
lines changed
3 files changed +18
-6
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
8
8
## Unreleased
9
9
10
+ ### Fixes
11
+ * commit msg history ordered the wrong way ([ #1445 ] ( https://github.com/extrawurst/gitui/issues/1445 ) )
12
+
10
13
## [ 0.22.1] - 2022-11-22
11
14
12
15
Bugfix followup release - check ` 0.22.0 ` notes for more infos!
Original file line number Diff line number Diff line change @@ -344,7 +344,7 @@ impl Component for CommitComponent {
344
344
strings:: commands:: commit_next_msg_from_history (
345
345
& self . key_config ,
346
346
) ,
347
- true ,
347
+ self . options . borrow ( ) . has_commit_msg_history ( ) ,
348
348
true ,
349
349
) ) ;
350
350
}
Original file line number Diff line number Diff line change @@ -104,15 +104,24 @@ impl Options {
104
104
self . save ( ) ;
105
105
}
106
106
107
+ pub fn has_commit_msg_history ( & self ) -> bool {
108
+ !self . data . commit_msgs . is_empty ( )
109
+ }
110
+
107
111
pub fn commit_msg ( & self , idx : usize ) -> Option < String > {
108
112
if self . data . commit_msgs . is_empty ( ) {
109
113
None
110
114
} else {
111
- Some (
112
- self . data . commit_msgs
113
- [ idx % self . data . commit_msgs . len ( ) ]
114
- . to_string ( ) ,
115
- )
115
+ let entries = self . data . commit_msgs . len ( ) ;
116
+ let mut index = idx;
117
+
118
+ while index >= entries {
119
+ index -= entries;
120
+ }
121
+
122
+ index = entries. saturating_sub ( 1 ) - index;
123
+
124
+ Some ( self . data . commit_msgs [ index] . to_string ( ) )
116
125
}
117
126
}
118
127
You can’t perform that action at this time.
0 commit comments