options: rename 'justifytrim' to 'trimblanks', because it has morphed

The option now causes nano to trim trailing whitespace also when
hardwrapping occurs while the user is typing.
This commit is contained in:
Benno Schulenberg 2017-12-02 14:02:26 +01:00
parent c30d3d8010
commit 66fd6a5ab1
7 changed files with 17 additions and 14 deletions

View File

@ -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.
@item 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.
@xref{@code{set functioncolor}} for valid color names.
@item set trimblanks
Remove trailing whitespace from wrapped lines when automatic
hard-wrapping occurs or when text is justified.
@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.

View File

@ -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
Remove trailing whitespace from wrapped lines when automatic
hard-wrapping occurs or when text is justified.
.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.

View File

@ -57,9 +57,6 @@
## Remember the used search/replace strings for the next session.
# set historylog
## Make the justify command kill whitespace at the end of lines.
# set justifytrim
## Display line numbers to the left of the text.
# set linenumbers
@ -175,6 +172,9 @@
## Save automatically on exit; don't prompt.
# set tempfile
## Snip whitespace at the end of lines when justifying or hard-wrapping.
# set trimblanks
## Disallow file modification. Why would you want this in an rcfile? ;)
# set view

View File

@ -527,7 +527,7 @@ enum
LOCKING,
NOREAD_MODE,
MAKE_IT_UNIX,
JUSTIFY_TRIM,
TRIM_BLANKS,
SHOW_CURSOR,
LINE_NUMBERS,
NO_PAUSES,

View File

@ -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},

View File

@ -1642,7 +1642,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)) {
@ -2414,7 +2414,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--;

View File

@ -7,7 +7,7 @@ comment "#"
icolor brightred "^[[:space:]]*((un)?(bind|set)|include|syntax|header|magic|comment|linter|formatter|i?color|extendsyntax).*$"
# Keywords
icolor brightgreen "^[[:space:]]*(set|unset)[[:space:]]+(allow_insecure_backup|atblanks|autoindent|backup|backwards|boldtext|casesensitive|constantshow|cutfromcursor|fill[[:space:]]+-?[[:digit:]]+|historylog|justifytrim|linenumbers|locking|morespace|mouse|multibuffer|noconvert|nohelp|nopauses|nonewlines|nowrap|positionlog|preserve|quickblank|quiet|rebinddelete|rebindkeypad|regexp|showcursor|smarthome|smooth|softwrap|suspend|tabsize[[:space:]]+[1-9][0-9]*|tabstospaces|tempfile|unix|view|wordbounds)\>"
icolor brightgreen "^[[:space:]]*(set|unset)[[:space:]]+(allow_insecure_backup|atblanks|autoindent|backup|backwards|boldtext|casesensitive|constantshow|cutfromcursor|fill[[:space:]]+-?[[:digit:]]+|historylog|linenumbers|locking|morespace|mouse|multibuffer|noconvert|nohelp|nopauses|nonewlines|nowrap|positionlog|preserve|quickblank|quiet|rebinddelete|rebindkeypad|regexp|showcursor|smarthome|smooth|softwrap|suspend|tabsize[[:space:]]+[1-9][0-9]*|tabstospaces|tempfile|trimblanks|unix|view|wordbounds)\>"
icolor yellow "^[[:space:]]*set[[:space:]]+((function|key|number|selected|status|title)color)[[:space:]]+(bright)?(white|black|red|blue|green|yellow|magenta|cyan)?(,(white|black|red|blue|green|yellow|magenta|cyan))?\>"
icolor brightgreen "^[[:space:]]*set[[:space:]]+(backupdir|brackets|functioncolor|keycolor|matchbrackets|numbercolor|operatingdir|punct|quotestr|selectedcolor|speller|statuscolor|titlecolor|whitespace|wordchars)[[:space:]]+"
icolor brightgreen "^[[:space:]]*bind[[:space:]]+((\^([[:alpha:]]|[]0-9\^_]|Space)|M-([[:alpha:]]|[]!"#$%&'()*+,./0-9:;<=>?@\^_`{|}~-]|Space))|F([1-9]|1[0-6])|Ins|Del)[[:space:]]+[[:alpha:]]+[[:space:]]+(all|main|search|replace(with)?|gotoline|writeout|insert|ext(ernal)?cmd|help|spell|linter|browser|whereisfile|gotodir)([[:space:]]+#|[[:space:]]*$)"