zyedidia / micro

A modern and intuitive terminal-based text editor
https://micro-editor.github.io
MIT License
24.39k stars 1.16k forks source link

Copy from micro to another program does not work when micro running over ssh from Git Bash #3275

Open harri-pasanen opened 2 months ago

harri-pasanen commented 2 months ago

Description of the problem or steps to reproduce

Copy from micro does not work, paste do micro does work.

Specifications

micro -version Version: 2.0.13 Commit hash: 68d88b57 Compiled on October 21, 2023

OS: Running micro on linux Terminal: Windows Git Bash

I'm running Git Bash on MS-Windows, and doing a ssh from there to linux VM.
Usually I hit Ctrl-Ins to copy the text from the terminal, and Shift-Ins to paste to terminal. This works if I use nano or vi, but copying from micro does not work.

Ctrl-C in micro seems to copy, but only within micro.

dmaluka commented 2 months ago

https://github.com/zyedidia/micro/blob/master/runtime/help/copypaste.md

harri-pasanen commented 2 months ago

Unfortunately the help link on copypaste did not list Git Bash among the supported terminals on Windows. Actually it does not mention any Windows terminals that I know of.

The only workaround I could find was settings.json as follows:

{ "mouse": false, "ruler": false }

And then doing the copy with mouse select followed by Ctrl+Insert.

Related, is there any way to toggle the ruler from the keyboard, rather than setting in permanently in the settings.json?

Andriamanitra commented 2 months ago

Related, is there any way to toggle the ruler from the keyboard, rather than setting in permanently in the settings.json?

By default Ctrl-r is bound to toggle the ruler (you can read all the default keybindings in help defaultkeys). To bind it to another key you can use the ToggleRuler action in your bindings.json.

More generally you can modify any setting with the set/setlocal commands: setlocal ruler off.

dmaluka commented 2 months ago

Unfortunately the help link on copypaste did not list Git Bash among the supported terminals on Windows. Actually it does not mention any Windows terminals that I know of.

So I guess you'd need to find out yourself if your terminal supports OSC 52.

harri-pasanen commented 2 months ago

The terminal in windows Git Bash seems to be mintty: https://mintty.github.io/ unfortunately that does not fully support OSC 52, https://github.com/mintty/mintty/issues/258 seems to have rejected that on security grounds.

But to recap, when I disable mouse in micro, I can use mouse to select in the terminal and copy using terminal keys (Ctrl-Insert). This seems make it on-par with vim or nano, so good enough.

Thanks for all the help.