File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -121,6 +121,15 @@ impl CommitList {
121
121
)
122
122
}
123
123
124
+ pub fn copy_entry_hash ( & self ) -> Result < ( ) > {
125
+ if let Some ( e) = self . items . iter ( ) . nth (
126
+ self . selection . saturating_sub ( self . items . index_offset ( ) ) ,
127
+ ) {
128
+ crate :: clipboard:: copy_string ( & e. hash_short ) ?;
129
+ }
130
+ Ok ( ( ) )
131
+ }
132
+
124
133
fn move_selection ( & mut self , scroll : ScrollType ) -> Result < bool > {
125
134
self . update_scroll_speed ( ) ;
126
135
Original file line number Diff line number Diff line change @@ -151,6 +151,11 @@ impl Revlog {
151
151
self . list . selected_entry ( ) . map ( |e| e. id )
152
152
}
153
153
154
+ fn copy_commit_hash ( & self ) -> Result < ( ) > {
155
+ self . list . copy_entry_hash ( ) ?;
156
+ Ok ( ( ) )
157
+ }
158
+
154
159
fn selected_commit_tags (
155
160
& self ,
156
161
commit : & Option < CommitId > ,
@@ -204,6 +209,9 @@ impl Component for Revlog {
204
209
self . commit_details . toggle_visible ( ) ?;
205
210
self . update ( ) ?;
206
211
return Ok ( true ) ;
212
+ } else if k == self . key_config . copy {
213
+ self . copy_commit_hash ( ) ?;
214
+ return Ok ( true ) ;
207
215
} else if k == self . key_config . log_tag_commit {
208
216
return self . selected_commit ( ) . map_or (
209
217
Ok ( false ) ,
You can’t perform that action at this time.
0 commit comments