Re: Softwrap at words for Markdown editing
Andreas Schamanek <[email protected]> Mon, 30 Sep 2024 21:26:25 +0200 (CEST)
| Newsgroups | gmane.editors.nano.general |
|---|---|
| Message-ID | <[email protected]> |
Hi Benno,
On Sun, 29 Sep 2024, at 17:55, Benno Schulenberg wrote:
> Op 29-09-2024 om 12:12 schreef Andreas Schamanek:
>> I am often editing Markdown texts in an 80 columns wide terminal
>> using nano with --softwrap. Due to the fact that many URLs these
>> days are longer than what easily fits 1 line, quite often we see
>> Markdown links produce quite some empty space. Like e.g. after
>> "[This" in
>>
>> [This
>> example](https://www.this.example.org/archive/2024/long-...-url)
> Indeed: nano is primarily an editor for texts, for long series of
> words separated by spaces and newlines. So --atblanks wraps only
> at whitespace, not at anything like punctuation or word boundaries.
>
> It would be possible to make a patch to make nano do softwrap also
> at word boundaries, but it will not be included into nano as checking
> for such boundaries is costly and would slow softwrap down too much.
I see.
> Also, with such word-edge wrapping your example would be wrapped as:
>
> [This example](https://www.this.example.org/archive/2024/
> long-...-url)
Yes. That's why I hinted at --wordchars thinking it might be an option
to make it configurable. Anyway, I do understand that it's not as
trivial as I was hoping.
I've never done much coding in C, but my brain tricked me into
believing you wrote it was "simple" to make a patch, and so I gave it
a try :) I only added ']' as another character where nano can
softwrap. The source compiled and nano wraps. So, I am happy and will
test this.
--
-- Andreas
:-)