feat: copy diff review comments to configured clipboard
This commit is contained in:
+15
-1
@@ -460,7 +460,7 @@ impl Editor {
|
||||
{
|
||||
self.review_diff_mut().unwrap().local_review.document = Review::new(root.clone());
|
||||
}
|
||||
if !matches!(action, Action::ReviewSave) {
|
||||
if !matches!(action, Action::ReviewSave | Action::ReviewCopy) {
|
||||
self.autosave_local_review()?;
|
||||
}
|
||||
if action == Action::ReviewOpen {
|
||||
@@ -539,6 +539,20 @@ impl Editor {
|
||||
self.show_review_comment(comments[index].id)?;
|
||||
}
|
||||
Action::ReviewOverview => self.open_review_overview()?,
|
||||
Action::ReviewCopy => {
|
||||
let review = &self.workspace_diff().unwrap().local_review.document;
|
||||
let count = review.comments.len();
|
||||
if count == 0 {
|
||||
return Err("No local review comments".into());
|
||||
}
|
||||
let text = review.format_text(true);
|
||||
self.store_clipboard(
|
||||
vec![text],
|
||||
self.clipboard_mode == ClipboardMode::System,
|
||||
false,
|
||||
)?;
|
||||
self.set_message(format!("Copied {count} review comments"));
|
||||
}
|
||||
Action::ReviewSummary => {
|
||||
let text = self
|
||||
.workspace_diff()
|
||||
|
||||
Reference in New Issue
Block a user