[prev in list] [next in list] [prev in thread] [next in thread] 

List:       nano-devel
Subject:    [Nano-devel] [PATCH 11/15] tweaks: switch from referencing NO_WRAP to referencing BREAK_LONG_LINES
From:       Benno Schulenberg <bensberg () telfort ! nl>
Date:       2019-01-31 16:49:37
Message-ID: 20190131164941.14074-11-bensberg () telfort ! nl
[Download RAW message or body]

---
 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 mailing list
Nano-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/nano-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic