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

Why is --noconvert CLI parameter/rc option not respected? #9

Closed garoto closed 3 years ago

garoto commented 5 years ago

I've read your readme.md entrie where you wrote: + UNIX style end-of-line handling by default.

And I have no issue with it being a default, but I'm wondering what's the rationale on why can't I override it either via CLI argument or via a .nanorc set noconvert option, but still able to choose CRLF line-endings with M-D when saving a file.

lhmouse commented 5 years ago

On Windows the function open() opens file in text mode by default. This means that if you try saving a file in MS-DOS format, nano will add a CR before every LF, but the CRT inserts another CR before every LF, resulting lines that end with CR CR LF. (By default however, nano does not insert CR because UNIX EOL is the default, while the CRT still adds a CR so you get MS-DOS EOLs, which 'works' by accident.)

Please refer to nano's authors for the precise description of noconvert; I have no idea about it.

garoto commented 5 years ago

Wow, quite complicated but I think I managed to finally get the gist of your answer rationale. And just to clear: by CRT you mean the microsoft "C RunTime"?

ps: sorry for the very late response :/