Skip to content

Add "CopyToClipboard" command to ConfirmationController #4810

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

kyu08
Copy link
Contributor

@kyu08 kyu08 commented Aug 10, 2025

PR Description

Sometimes, I want to copy the error message to clipboard to search google or ask to LLM about the error message.

So I added CopyToClipboard command to ConfirmationController and I have confirmed that this command copies the content of the window to the clipboard.

image

Please check if the PR fulfills these requirements

  • Cheatsheets are up-to-date (run go generate ./...)
  • Code has been formatted (see here)
  • Tests have been added/updated (see here for the integration test guide)
  • Text is internationalised (see here)
  • If a new UserConfig entry was added, make sure it can be hot-reloaded (see here)
  • Docs have been updated if necessary
  • You've read through your own file changes for silly mistakes etc

@kyu08 kyu08 marked this pull request as ready for review August 10, 2025 10:51
@kyu08 kyu08 force-pushed the copy-confirmation-text branch from e927974 to c544f39 Compare August 11, 2025 12:18
@stefanhaller stefanhaller added the enhancement New feature or request label Aug 11, 2025
@stefanhaller
Copy link
Collaborator

Nice, seems useful.

Two things:

  • there's no feedback when pressing the key; usually we show a toast in the status line, but apparently toasts are suppressed when a popup is showing? Would have to investigate why, or if it's possible to change that.
  • I feel the <c-o> keybinding should not be between enter and esc, but to the right of esc, which is by far the more important key to know about. However, then it ends up between the two esc bindings, so that would have to be solved first.

@kyu08
Copy link
Contributor Author

kyu08 commented Aug 11, 2025

Thanks for the feedback!

  • there's no feedback when pressing the key; usually we show a toast in the status line, but apparently toasts are suppressed when a popup is showing? Would have to investigate why, or if it's possible to change that.

I'll look into it.

  • I feel the keybinding should not be between enter and esc, but to the right of esc, which is by far the more important key to know about.

That's right! This is fixed in e7505c4.

However, then it ends up between the two esc bindings, so that would have to be solved first.

So how about adding an implementation like this first, then merging this PR, and then deleting unnecessary key bindings?

@kyu08
Copy link
Contributor Author

kyu08 commented Aug 11, 2025

  • there's no feedback when pressing the key; usually we show a toast in the status line, but apparently toasts are suppressed when a popup is showing? Would have to investigate why, or if it's possible to change that.

I found the cause. self.c.OS().CopyToClipboard(text) does not simply call the Toast() method .
So it might be fine to just call it in the Handler.
Fixed in 494edfc.

@kyu08 kyu08 force-pushed the copy-confirmation-text branch from cd8205b to f60838c Compare August 11, 2025 14:42
@kyu08 kyu08 force-pushed the copy-confirmation-text branch from f60838c to 494edfc Compare August 11, 2025 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants