summaryrefslogtreecommitdiffstats
path: root/src/tabs
diff options
context:
space:
mode:
authorAlexandru Macovei <alexnmaco@gmail.com>2022-11-05 17:51:03 +0200
committerGitHub <noreply@github.com>2022-11-05 16:51:03 +0100
commite371153034db126235f342b52e2e6301e0880e70 (patch)
tree96d1fbebe97e772bddb0933f952d4578bc000f72 /src/tabs
parenta172b184284f448819f74fa968ef3677c8d297d0 (diff)
Report failure to copy to clipboard (#1410)
* (refactor) move copy_commit_hash from revlog into commitlist, and make fewer functions public in commitlist * (refactor) reduce duplication in commit copying code; use already-stored commits instead of looking up items * (clipboard) actually check subprocess exit status, and report failure instead of ignoring it * (commitlist) display popup with copy failure instead of exiting the application on error
Diffstat (limited to 'src/tabs')
-rw-r--r--src/tabs/revlog.rs15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/tabs/revlog.rs b/src/tabs/revlog.rs
index d8c83fa7..1e146592 100644
--- a/src/tabs/revlog.rs
+++ b/src/tabs/revlog.rs
@@ -163,15 +163,6 @@ impl Revlog {
self.list.selected_entry().map(|e| e.id)
}
- fn copy_commit_hash(&self) -> Result<()> {
- if self.list.marked_count() > 1 {
- self.list.copy_marked_hashes()?;
- } else {
- self.list.copy_entry_hash()?;
- }
- Ok(())
- }
-
fn selected_commit_tags(
&self,
commit: &Option<CommitId>,
@@ -260,7 +251,11 @@ impl Component for Revlog {
self.update()?;
return Ok(EventState::Consumed);
} else if key_match(k, self.key_config.keys.copy) {
- self.copy_commit_hash()?;
+ try_or_popup!(
+ self,
+ strings::POPUP_FAIL_COPY,
+ self.list.copy_commit_hash()
+ );
return Ok(EventState::Consumed);
} else if key_match(k, self.key_config.keys.push) {
self.queue.push(InternalEvent::PushTags);