lhmouse / nano-win

GNU nano text editor for Windows [WARNING: The master branch is constantly rebased and force-pushed so don't expect it to be steady!! -end WARNING]
https://files.lhmouse.com/nano-win/
GNU General Public License v3.0
210 stars 25 forks source link

Pasting from clipboard instead of cutbuffer? #15

Closed Unknow0059 closed 3 years ago

Unknow0059 commented 3 years ago

Is this supported, or am I missing something?

Expected:

Occurred:

lhmouse commented 3 years ago

No, it is not supported. Nano has no access to the Windows clipboard. Normally it is the terminal driver that does that, which means inside CMD you may only select text and copy it by right-clicking. Note CMD itself does not support non-rectangle selection.

Not only is this the case on Windows, it is also what people do on Linux. See https://www.nano-editor.org/dist/v5/faq.html#4.4.

Unknow0059 commented 3 years ago

Ok.

What about code highlighting? As described here.

Also, I just tried ^+V (Ctrl Shift V) and it worked just fine.

lhmouse commented 3 years ago

It is supported, but the bundled .nanorc contains Unix paths which you have to replace with Windows paths such as D:/nano/syntax/*.nanorc.

Unknow0059 commented 3 years ago

Where exactly should the bundled .nanorc be placed in order for nano to recognize it? In the archive, it is placed above the directory that comes with nano's bin and share folders. Doesn't seem to be recognized there. Nor on %USERPROFILE% for that matter. Also, if .nanorc is supported, how come set isn't? If I try set wordwrap I get a Not supported on Windows error.

lhmouse commented 3 years ago

.nanorc. should be placed in your home directory. On my computer it is C:/Users/lhmouse. You should ensure it is named .nanorc, not .nanorc.nanorc or .nanorc.text whatsoever, as explorer does not display extensions by default.

Where did you get the Not supported on Windows error? It only happens when you attempt to suspend nano (with Ctrl-Z) or to execute a command (with Ctrl-T, or Ctrl-R followed by Ctrl-X).

Unknow0059 commented 3 years ago

As previously mentioned, .nanorc is not recognized in %USERPROFILE%, which is an environment variable that on my computer expands to C:/Users/ followed by a folder named after my Windows account's name.

Error:

nano_unsupported_bug

The fact that I have a new buffer opened instead of a file does not make a difference.

lhmouse commented 3 years ago

I suppose you run nano with admin privilege? Then %ALLUSERSPROFILE%/.nanorc is used instead. See https://github.com/lhmouse/nano-win/commit/4e3ff45b6046b17937166d1b98355de6828307ac#diff-3e04e056edbdc0f772b0ffd1c93cef1187209f37276d40d2a281d9b989398a73R41.

Rationale: If you run nano on Linux with a non-root user, then $HOME/.nanorc is loaded. But if you run sudo nano then the effective UID is zero (root) and /root/.nanorc is loaded instead.

Unknow0059 commented 3 years ago

Placing .nanorc in %ALLUSERSPROFILE% doesn't seem to have had any effect. Of course, I've made sure that some settings from there have been uncommented. Specifically the ones from under: ## Paint the interface elements of nano. These are examples; Which would be easily viewed when in effect.

lhmouse commented 3 years ago

I have no idea. Perhaps you can build nano locally, and use GDB to set breakpoints on the have_nanorc() and parse_one_nanorc() functions, to find out whether the global variable nanorc is assigned a valid path.

You cannot use the execute command feature to turn on/off options. To enable/disable soft wrapping. press Alt-$ i.e. Alt-Shift-4 on an American keyboard.

Unknow0059 commented 3 years ago

This week I had been hibernating my computer instead of shutting it down so I wouldn't lose my virtual desktops. Yesterday I was having some issues with explorer.exe , Virtual Desktops, and fullscreen programs, so I finally restarted my computer. Today I tried running nano-win again with .nanorc in %USERPROFILE% and the settings applied as expected. It seems the lack of shutdown had been causing issues here, too.

I have the environment variable %HOME% set to a folder within that directory in the hopes that I can keep all my Unix files in one place instead of scattered in Users. For that reason it is inconvenient that nano-win ignores the variable, but I am very glad that the settings are just working now.

lhmouse commented 3 years ago

HOME isn't a standard variable on Windows so it's probably unreliable.

Unknow0059 commented 3 years ago

I suggested because vim on windows uses it. Nevermind, however. git bash also uses it.