Skip to content
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

unexpected behavior of ^V key combo #21

Open
chawyehsu opened this issue Mar 5, 2023 · 7 comments
Open

unexpected behavior of ^V key combo #21

chawyehsu opened this issue Mar 5, 2023 · 7 comments

Comments

@chawyehsu
Copy link

chawyehsu commented Mar 5, 2023

cut/copy and paste will output garbled or invisible text.

example bindings

bind ^X cut main
bind ^C copy main
bind ^V paste main 

Open a file, nanorc for example, use copy/cut binding to copy/cut a line of text, and try to paste with paste binding to a new line.

The same configuration works with nano-win.

@okibcn
Copy link
Owner

okibcn commented Mar 5, 2023

Quite unexpected. I can't duplicate the issue. I have that exact combination and works not only in Windows Terminal, but also in Wincon, though SSH from Windows or from a Linux system. Could you please describe the setup you are using? I can't do anything without a clear description of the environment.

See here a demo session of copy-n-paste I have just recorded accessing a Windows system from a Linux terminal:
ses

@chawyehsu
Copy link
Author

chawyehsu commented Mar 5, 2023

Please note that ^V in Windows Terminal is captured by the terminal app, you have to unbind that key from WT to be usable in WT.

No, it does nothing with WT, not even work in PowerShell/ConsoleHost. Recorded in a brand new Windows 10 VM with a fresh environment, no custom nanorc, no custom PowerShell settings:

nano

Notice the difference with lhmouse's nano-win.

@okibcn
Copy link
Owner

okibcn commented Mar 5, 2023

Could you please test pate with another key combo such as ^A or ^B, ^D in .nanorc? Just to see whether the problem is the ^V capture or the underlying function.

I am working on integrating the clipboard with the windows clipboard which would eliminate this problem completely.

@chawyehsu
Copy link
Author

Could you please test pate with another key combo such as ^A or ^B, ^D in .nanorc? Just to see whether the problem is the ^V capture or the underlying function.

I just tested with ^A and ^D, and both worked.

@chawyehsu chawyehsu changed the title unexpected behaviors of cut/copy/paste bindings unexpected behavior of ^V key combo Mar 5, 2023
@okibcn
Copy link
Owner

okibcn commented Mar 5, 2023

Thanks. The problem is then the capture of ^V from windows. The same happens with WT. When you press ^V You are actually pasting whatever is in the windows clipboard. Depending on the encoding nano understands it or not. Windows 10 is not fully UTF-8 friendly, so the wincon, the main reason Microsoft deprecated it in favor of Windows Terminal.

The fix with the Windows clipboard will solve that while allowing easy copy-n-paste to/from nano without disabling the mouse in nano.

@okibcn
Copy link
Owner

okibcn commented Mar 6, 2023

In the meantime, you can always disconnect the Ctrl-V combo from Windows Terminal, something required for other editors such as vim. Just read this: https://stackoverflow.com/a/65109836/7691477

Other terminal apps probably don't have the flexibility of overriding the windows key shortcuts. This is why I am implementing the windows clipboard within nano.

@chawyehsu
Copy link
Author

chawyehsu commented Mar 6, 2023

In the meantime, you can always disconnect the Ctrl-V combo from Windows Terminal, something required for other editors such as vim. Just read this: https://stackoverflow.com/a/65109836/7691477

Not my case, I use Shift + Insert most of the time, I don't have ^V combo for my Windows Terminal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants