[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Nano-devel] [PATCH 2/2] options: rename 'justifytrim' to 'trimblanks',
From: |
Benno Schulenberg |
Subject: |
[Nano-devel] [PATCH 2/2] options: rename 'justifytrim' to 'trimblanks', because it has morphed |
Date: |
Sat, 2 Dec 2017 14:08:58 +0100 |
The option now causes nano to trim trailing whitespace also when
hard-wrapping occurs while the user is typing.
---
doc/nano.texi | 7 ++++---
doc/nanorc.5 | 7 ++++---
src/nano.h | 2 +-
src/rcfile.c | 3 ++-
src/text.c | 4 ++--
5 files changed, 13 insertions(+), 10 deletions(-)
diff --git a/doc/nano.texi b/doc/nano.texi
index ac614911..a0d66c1e 100644
--- a/doc/nano.texi
+++ b/doc/nano.texi
@@ -753,9 +753,6 @@ And either @var{fgcolor} or ,@var{bgcolor} may be left out.
Save the last hundred search strings and replacement strings and
executed commands, so they can be easily reused in later sessions.
address@hidden set justifytrim
-When justifying text, trailing whitespace will automatically be removed.
-
@item set keycolor @var{fgcolor},@var{bgcolor}
Use this color combination for the shortcut key combos
in the two help lines at the bottom of the screen.
@@ -899,6 +896,10 @@ Save automatically on exit, don't prompt.
Use this color combination for the title bar.
@address@hidden functioncolor}} for valid color names.
address@hidden set trimblanks
+When automatic hard-wrapping occurs or when justifying text, trailing
+whitespace will automatically be removed from the wrapped lines.
+
@item set unix
Save a file by default in Unix format. This overrides nano's
default behavior of saving a file in the format that it had.
diff --git a/doc/nanorc.5 b/doc/nanorc.5
index 25277a5e..34247703 100644
--- a/doc/nanorc.5
+++ b/doc/nanorc.5
@@ -118,9 +118,6 @@ See \fBset titlecolor\fR for more details.
Save the last hundred search strings and replacement strings and
executed commands, so they can be easily reused in later sessions.
.TP
-.B set justifytrim
-When justifying text, trailing whitespace will automatically be removed.
-.TP
.B set keycolor \fIfgcolor\fR,\fIbgcolor\fR
Specify the color combination to use for the shortcut key combos
in the two help lines at the bottom of the screen.
@@ -269,6 +266,10 @@ Valid names for the foreground and background colors are:
The name of the foreground color may be prefixed with \fBbright\fR.
And either "\fIfgcolor\fR" or ",\fIbgcolor\fR" may be left out.
.TP
+.B set trimblanks
+When automatic hard-wrapping occurs or when justifying text, trailing
+whitespace will automatically be removed from the wrapped lines.
+.TP
.B set unix
Save a file by default in Unix format. This overrides nano's
default behavior of saving a file in the format that it had.
diff --git a/src/nano.h b/src/nano.h
index 3343b9a4..7ce36646 100644
--- a/src/nano.h
+++ b/src/nano.h
@@ -527,7 +527,7 @@ enum
LOCKING,
NOREAD_MODE,
MAKE_IT_UNIX,
- JUSTIFY_TRIM,
+ TRIM_BLANKS,
SHOW_CURSOR,
LINE_NUMBERS,
NO_PAUSES,
diff --git a/src/rcfile.c b/src/rcfile.c
index 7a619c31..6d543315 100644
--- a/src/rcfile.c
+++ b/src/rcfile.c
@@ -96,7 +96,7 @@ static const rcoption rcopts[] = {
{"casesensitive", CASE_SENSITIVE},
{"cut", CUT_FROM_CURSOR}, /* deprecated form, remove in 2020 */
{"cutfromcursor", CUT_FROM_CURSOR},
- {"justifytrim", JUSTIFY_TRIM},
+ {"justifytrim", TRIM_BLANKS}, /* deprecated form, remove in 2020 */
{"locking", LOCKING},
{"matchbrackets", 0},
{"noconvert", NO_CONVERT},
@@ -106,6 +106,7 @@ static const rcoption rcopts[] = {
{"smooth", SMOOTH_SCROLL},
{"softwrap", SOFTWRAP},
{"tabstospaces", TABS_TO_SPACES},
+ {"trimblanks", TRIM_BLANKS},
{"unix", MAKE_IT_UNIX},
{"whitespace", 0},
{"wordbounds", WORD_BOUNDS},
diff --git a/src/text.c b/src/text.c
index b6f2728e..64d739d9 100644
--- a/src/text.c
+++ b/src/text.c
@@ -1653,7 +1653,7 @@ bool do_wrap(filestruct *line)
openfile->current_x = wrap_loc;
/* When requested, snip trailing blanks off the wrapped line. */
- if (ISSET(JUSTIFY_TRIM)) {
+ if (ISSET(TRIM_BLANKS)) {
size_t cur_x = move_mbleft(line->data, wrap_loc);
while (is_blank_mbchar(line->data + cur_x) && cur_x > 0) {
@@ -2425,7 +2425,7 @@ void do_justify(bool full_justify)
}
#endif
/* When requested, snip all trailing blanks. */
- if (ISSET(JUSTIFY_TRIM)) {
+ if (ISSET(TRIM_BLANKS)) {
while (break_pos > 0 &&
is_blank_mbchar(&openfile->current->data[break_pos -
1])) {
break_pos--;
--
2.14.3