mirror of
https://github.com/extrawurst/gitui.git
synced 2024-12-29 12:06:26 +03:00
copy commit hash
This commit is contained in:
parent
587acf219e
commit
3101f7b104
@ -121,6 +121,15 @@ impl CommitList {
|
||||
)
|
||||
}
|
||||
|
||||
pub fn copy_entry_hash(&self) -> Result<()> {
|
||||
if let Some(e) = self.items.iter().nth(
|
||||
self.selection.saturating_sub(self.items.index_offset()),
|
||||
) {
|
||||
crate::clipboard::copy_string(&e.hash_short)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn move_selection(&mut self, scroll: ScrollType) -> Result<bool> {
|
||||
self.update_scroll_speed();
|
||||
|
||||
|
@ -151,6 +151,11 @@ impl Revlog {
|
||||
self.list.selected_entry().map(|e| e.id)
|
||||
}
|
||||
|
||||
fn copy_commit_hash(&self) -> Result<()> {
|
||||
self.list.copy_entry_hash()?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn selected_commit_tags(
|
||||
&self,
|
||||
commit: &Option<CommitId>,
|
||||
@ -204,6 +209,9 @@ impl Component for Revlog {
|
||||
self.commit_details.toggle_visible()?;
|
||||
self.update()?;
|
||||
return Ok(true);
|
||||
} else if k == self.key_config.copy {
|
||||
self.copy_commit_hash()?;
|
||||
return Ok(true);
|
||||
} else if k == self.key_config.log_tag_commit {
|
||||
return self.selected_commit().map_or(
|
||||
Ok(false),
|
||||
|
Loading…
Reference in New Issue
Block a user