nano-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] tweaks: allow alternate line endings in rc files


From: Benno Schulenberg
Subject: Re: [PATCH] tweaks: allow alternate line endings in rc files
Date: Sun, 19 Jan 2020 14:40:38 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1

Op 18-01-2020 om 16:27 schreef Matthias A.:
> Many people nowadays synchronize, share and transport various config files
> between various devices by various transport methods. Occasionally these files
> get a little mangled, especially line endings and whitespace characters. Nano
> currently expects the lines in [its] config files to end on a single LF and
> nothing but a LF. Making it a little less strict about that could help users
> with slightly mangled files.
Hmm...  Personally I wouldn't want to make nano more lenient, but...
since Eitan agrees, and it's just two lines of code: okay.

Thanks for the patch.  However, it does not work for me.  When I save
my ~/.nanorc in DOS format (^O M-D <Enter>), and then run a nano with
the patch applied (without the config file stuff), then it still chokes
on most of the option lines:

  "rror in /home/ben/.nanorc on line 2: Unknown option "quickblank
  "rror in /home/ben/.nanorc on line 4: Unknown option "smooth
  " not understooden/.nanorc on line 6: Command "
  " is invalidme/ben/.nanorc on line 8: Requested fill size "76
  "rror in /home/ben/.nanorc on line 9: Unknown option "nowrap

When I change the fragment of code to:

        if (buffer[len - 2] == '\r')
                buffer[len - 2] = '\0';

then running nano with a DOS-formatted rcfile works fine.  If that is
the same for you, then please submit an improved patch (without the
config file stuff).  If not, then please submit a patch that covers
all cases (lines that end with just \n or just \r or \r\n).

Benno

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]