[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Nano-devel] [PATCH 11/15] tweaks: switch from referencing NO_WRAP to re
From: |
Benno Schulenberg |
Subject: |
[Nano-devel] [PATCH 11/15] tweaks: switch from referencing NO_WRAP to referencing BREAK_LONG_LINES |
Date: |
Thu, 31 Jan 2019 17:49:37 +0100 |
---
src/global.c | 6 +++---
src/nano.c | 12 ++----------
src/text.c | 8 ++++----
3 files changed, 9 insertions(+), 17 deletions(-)
diff --git a/src/global.c b/src/global.c
index 10d1f4af..4860a079 100644
--- a/src/global.c
+++ b/src/global.c
@@ -1256,7 +1256,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);
@@ -1407,7 +1407,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");
@@ -1666,7 +1666,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
index 01d7e869..79ddd433 100644
--- a/src/nano.c
+++ b/src/nano.c
@@ -1393,7 +1393,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)),
@@ -1903,7 +1903,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
}
@@ -2415,14 +2415,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
index 5ffdb072..9992521c 100644
--- 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
@@ -3071,7 +3071,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... */
@@ -3177,7 +3177,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],
@@ -3185,7 +3185,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
--
2.19.2
- [Nano-devel] [PATCH 01/15] options: add -b, --breaklonglines, the counterpart of --nowrap, Benno Schulenberg, 2019/01/31
- [Nano-devel] [PATCH 02/15] options: add -f, --finalnewline, the counterpart of --nonewlines, Benno Schulenberg, 2019/01/31
- [Nano-devel] [PATCH 03/15] options: add -j, --jumpyscrolling, the counterpart of --smooth, Benno Schulenberg, 2019/01/31
- [Nano-devel] [PATCH 04/15] options: add -e, --emptyline, the counterpart of --morespace, Benno Schulenberg, 2019/01/31
- [Nano-devel] [PATCH 05/15] rcfile: add the options that correspond to -b, -f, -j, and -e, Benno Schulenberg, 2019/01/31
- [Nano-devel] [PATCH 06/15] options: when a nanorc unsets an old flag, set the corresponding new flag, Benno Schulenberg, 2019/01/31
- [Nano-devel] [PATCH 07/15] options: let --fill no longer imply automatic hard-wrapping, Benno Schulenberg, 2019/01/31
- [Nano-devel] [PATCH 08/15] docs: stop saying that --fill switches on automatic hard-wrapping, Benno Schulenberg, 2019/01/31
- [Nano-devel] [PATCH 09/15] docs: describe the four new options (-b, -f, -j, -e) [*incomplete*], Benno Schulenberg, 2019/01/31
- [Nano-devel] [PATCH 10/15] options: warn when -L, -O, -S, or -w are given, and ignore them, Benno Schulenberg, 2019/01/31
- [Nano-devel] [PATCH 11/15] tweaks: switch from referencing NO_WRAP to referencing BREAK_LONG_LINES,
Benno Schulenberg <=
- [Nano-devel] [PATCH 12/15] tweaks: switch from referencing NO_NEWLINES to referencing FINAL_NEWLINE, Benno Schulenberg, 2019/01/31