nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit ad5d0f7530e7c8e64be98e048471f8e6507e1762
parent 0f2b0ffbd3afcc839d8c9af56ca699881ccb0e22
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Wed, 30 May 2018 20:45:06 +0200

wrapping: use "smart" autoindenting only when hard-wrapping is enabled

The paragraph-aware indenting is needed only when automatic long-line
wrapping is on (that is, when not using 'nowrap': when writing prose).
When writing code, the user most likely uses --nowrap, which will make
nano indent a new line always to the same amount as the preceding line
-- when --autoindent is in effect, of course.

Diffstat:
Msrc/text.c | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/text.c b/src/text.c @@ -1035,8 +1035,8 @@ void do_enter(void) #ifdef ENABLE_JUSTIFY /* If the next line is in this same paragraph, use its indentation * as the model, as it is more likely to be what the user wants. */ - if (sampleline->next && inpar(sampleline->next) && - !begpar(sampleline->next, 0)) + if (!ISSET(NO_WRAP) && sampleline->next != NULL && + inpar(sampleline->next) && !begpar(sampleline->next, 0)) sampleline = sampleline->next; #endif extra = indent_length(sampleline->data);