-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a "Copy to clipboard" menu to the Commit Files panel #4271
Add a "Copy to clipboard" menu to the Commit Files panel #4271
Conversation
@@ -41,6 +41,12 @@ func NewCommitFilesController( | |||
|
|||
func (self *CommitFilesController) GetKeybindings(opts types.KeybindingsOpts) []*types.Binding { | |||
bindings := []*types.Binding{ | |||
{ | |||
Key: opts.GetKey(opts.Config.Files.CopyFileInfoToClipboard), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm using a key from the Files section here, which could be considered wrong. Actually I think it's ok though, I prefer this both to adding a new one to the CommitFiles section, and to moving it into Universal. It's also not the first time we do this, we are already using a few others from the Files section here.
Coverage summary from CodacySee diff coverage on Codacy
Coverage variation details
Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: Diff coverage details
Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: See your quality gate settings Change summary preferencesCodacy stopped sending the deprecated coverage status on June 5th, 2024. Learn more Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Change our fake clipboard command to not append a linefeed; that's closer to what the production code does. This allows us to use Equals instead of Contains for checking the clipboard contents. Finally, use FileSystem().FileContent() to assert the clipboard contents, instead of selecting the clipboard file and then checking the diff view.
This is very similar to the same menu in the Files panel, except that it works on whatever diff is currently shown in the main view, including range diffs either in diffing mode (shift-W), or from a range selection of commits.
29f6b17
to
c919681
Compare
Add a "Copy to clipboard" menu to the Commit Files panel
This is very similar to the same menu in the Files panel, except that it works on whatever diff is currently shown in the main view, including range diffs either in diffing mode (shift-W), or from a range selection of commits.
The menu has some code duplication with the existing menu in the Files panel, but actually not so much. The first two menu items could be unified once we have generalized the filetrees, but these are pretty trivial; the other two menu items are sufficiently different that unifying them is not practical, I think.
Fixes #4254.
go generate ./...
)