nano

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

commit 54055b6174eccb392807c1426276e86c03f11692
parent 327025018466a302024e90b97b6dfb59d061935d
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Tue, 29 Jan 2019 20:03:59 +0100

tweaks: switch from referencing NO_WRAP to referencing BREAK_LONG_LINES

Diffstat:
Msrc/global.c | 6+++---
Msrc/nano.c | 12++----------
Msrc/text.c | 8++++----
3 files changed, 9 insertions(+), 17 deletions(-)

diff --git a/src/global.c b/src/global.c @@ -1252,7 +1252,7 @@ void shortcut_init(void) add_to_sclist(MMAIN, "M-I", 0, do_toggle_void, AUTOINDENT); add_to_sclist(MMAIN, "M-K", 0, do_toggle_void, CUT_FROM_CURSOR); #ifdef ENABLE_WRAPPING - add_to_sclist(MMAIN, "M-L", 0, do_toggle_void, NO_WRAP); + add_to_sclist(MMAIN, "M-L", 0, do_toggle_void, BREAK_LONG_LINES); #endif add_to_sclist(MMAIN, "M-O", 0, do_toggle_void, TABS_TO_SPACES); @@ -1403,7 +1403,7 @@ const char *flagtostr(int flag) return N_("Auto indent"); case CUT_FROM_CURSOR: return N_("Cut to end"); - case NO_WRAP: + case BREAK_LONG_LINES: return N_("Hard wrapping of overlong lines"); case TABS_TO_SPACES: return N_("Conversion of typed tabs to spaces"); @@ -1662,7 +1662,7 @@ sc *strtosc(const char *input) s->toggle = CUT_FROM_CURSOR; #ifdef ENABLE_WRAPPING else if (!strcasecmp(input, "nowrap")) - s->toggle = NO_WRAP; + s->toggle = BREAK_LONG_LINES; #endif else if (!strcasecmp(input, "tabstospaces")) s->toggle = TABS_TO_SPACES; diff --git a/src/nano.c b/src/nano.c @@ -1402,7 +1402,7 @@ void do_toggle(int flag) enabled = ISSET(flag); - if (flag == NO_HELP || flag == NO_WRAP || flag == NO_COLOR_SYNTAX) + if (flag == NO_HELP || flag == NO_COLOR_SYNTAX) enabled = !enabled; statusline(HUSH, "%s %s", _(flagtostr(flag)), @@ -1912,7 +1912,7 @@ void do_output(char *output, size_t output_len, bool allow_cntrls) #ifdef ENABLE_WRAPPING /* If text gets wrapped, the edit window needs a refresh. */ - if (!ISSET(NO_WRAP) && do_wrap(openfile->current)) + if (ISSET(BREAK_LONG_LINES) && do_wrap(openfile->current)) refresh_needed = TRUE; #endif } @@ -2422,14 +2422,6 @@ int main(int argc, char **argv) } #endif /* ENABLE_NANORC */ -#ifdef ENABLE_WRAPPING - /* A --fill on the command line overrides a "set nowrap" in an rcfile. */ - if (ISSET(BREAK_LONG_LINES)) - UNSET(NO_WRAP); - else - SET(NO_WRAP); -#endif - if (ISSET(FINAL_NEWLINE)) UNSET(NO_NEWLINES); else diff --git a/src/text.c b/src/text.c @@ -875,7 +875,7 @@ void do_enter(void) #ifdef ENABLE_JUSTIFY /* When doing automatic long-line wrapping and the next line is * in this same paragraph, use its indentation as the model. */ - if (!ISSET(NO_WRAP) && sampleline->next != NULL && + if (ISSET(BREAK_LONG_LINES) && sampleline->next != NULL && inpar(sampleline->next) && !begpar(sampleline->next, 0)) sampleline = sampleline->next; #endif @@ -3072,7 +3072,7 @@ void complete_a_word(void) size_t i = 0, j = 0; completion_word *some_word; #ifdef ENABLE_WRAPPING - bool was_set_wrapping = !ISSET(NO_WRAP); + bool was_set_wrapping = ISSET(BREAK_LONG_LINES); #endif /* If this is a fresh completion attempt... */ @@ -3178,7 +3178,7 @@ void complete_a_word(void) #ifdef ENABLE_WRAPPING /* Temporarily disable wrapping so only one undo item is added. */ - SET(NO_WRAP); + UNSET(BREAK_LONG_LINES); #endif /* Inject the completion into the buffer. */ do_output(&completion[shard_length], @@ -3186,7 +3186,7 @@ void complete_a_word(void) #ifdef ENABLE_WRAPPING /* If needed, reenable wrapping and wrap the current line. */ if (was_set_wrapping) { - UNSET(NO_WRAP); + SET(BREAK_LONG_LINES); do_wrap(openfile->current); } #endif