commit 9f98333dce21151de64b34b224a80e5dc9e701a4
parent 486e8284437d8fe73e0e20f7b82e9c55c471aeca
Author: Chris Allegretta <chrisa@asty.org>
Date: Thu, 25 Feb 2016 21:04:45 +0000
Call kill_spaces_on_justify justifytrim, to match the rest of rcfile naming conventions.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5679 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
Diffstat:
7 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -17,7 +17,7 @@
2016-02-22 Chris Allegretta <chrisa@asty.org>
* Add the ability to kill the trailing spaces when justifying text,
- by adding a new nanorc option 'kill_spaces_on_justify' -- we'll see
+ by adding a new nanorc option 'justifytrim' -- we'll see
whether this warrants a command-line flag or not. Now with slightly
better logic for multi-spaced lines.
diff --git a/doc/man/nanorc.5 b/doc/man/nanorc.5
@@ -111,6 +111,9 @@ See \fBset titlecolor\fR for more details.
Enable the use of \fB~/.nano/search_history\fP for saving and reading
search/replace strings.
.TP
+.B set justifytrim
+When justifying text, trailing newlines 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.
diff --git a/doc/nanorc.sample.in b/doc/nanorc.sample.in
@@ -60,6 +60,9 @@
## Remember the used search/replace strings for the next session.
# set historylog
+## Have the justify command kill whitespace at the end of lines
+# set justifytrim
+
## Enable vim-style lock-files. This is just to let a vim user know you
## are editing a file [s]he is trying to edit and vice versa. There are
## no plans to implement vim-style undo state in these files.
diff --git a/doc/syntax/nanorc.nanorc b/doc/syntax/nanorc.nanorc
@@ -6,7 +6,7 @@ syntax "nanorc" "\.?nanorc$"
icolor brightred "^[[:space:]]*((un)?(bind|set)|include|syntax|header|magic|linter|i?color|extendsyntax).*$"
# Keywords
-icolor brightgreen "^[[:space:]]*(set|unset)[[:space:]]+(allow_insecure_backup|autoindent|backup|backwards|boldtext|casesensitive|const(antshow)?|cut|fill|historylog|locking|morespace|mouse|multibuffer|noconvert|nohelp|nonewlines|nowrap|pos(ition)?log|preserve|quickblank|quiet|rebinddelete|rebindkeypad|regexp|smarthome|smooth|softwrap|suspend|tabsize|tabstospaces|tempfile|unix|view|wordbounds|kill_spaces_on_justify)\>"
+icolor brightgreen "^[[:space:]]*(set|unset)[[:space:]]+(allow_insecure_backup|autoindent|backup|backwards|boldtext|casesensitive|const(antshow)?|cut|fill|historylog|locking|morespace|mouse|multibuffer|noconvert|nohelp|nonewlines|nowrap|pos(ition)?log|preserve|quickblank|quiet|rebinddelete|rebindkeypad|regexp|smarthome|smooth|softwrap|suspend|tabsize|tabstospaces|tempfile|unix|view|wordbounds|justify_trim)\>"
icolor yellow "^[[:space:]]*set[[:space:]]+(functioncolor|keycolor|statuscolor|titlecolor)[[: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|operatingdir|punct|quotestr|speller|statuscolor|titlecolor|whitespace)[[:space:]]+"
icolor brightgreen "^[[:space:]]*bind[[:space:]]+((\^|M-)([[:alpha:]]|space|[]]|[0-9^_=+{}|;:'\",./<>\?-])|F([1-9]|1[0-6])|Ins|Del)[[:space:]]+[[:alpha:]]+[[:space:]]+(all|main|search|replace(2|with)?|gotoline|writeout|insert|ext(ernal)?cmd|help|spell|linter|browser|whereisfile|gotodir)([[:space:]]+#|[[:space:]]*$)"
diff --git a/src/nano.h b/src/nano.h
@@ -518,7 +518,7 @@ enum
LOCKING,
NOREAD_MODE,
MAKE_IT_UNIX,
- KILL_TRAILING_SPACES
+ JUSTIFY_TRIM
};
/* Flags for the menus in which a given function should be present. */
diff --git a/src/rcfile.c b/src/rcfile.c
@@ -90,7 +90,7 @@ static const rcoption rcopts[] = {
{"backwards", BACKWARDS_SEARCH},
{"casesensitive", CASE_SENSITIVE},
{"cut", CUT_TO_END},
- {"kill_spaces_on_justify", KILL_TRAILING_SPACES},
+ {"justifytrim", JUSTIFY_TRIM},
{"locking", LOCKING},
{"matchbrackets", 0},
{"noconvert", NO_CONVERT},
diff --git a/src/text.c b/src/text.c
@@ -1279,7 +1279,7 @@ bool do_wrap(filestruct *line)
/* If after_break doesn't end in a blank, make sure it ends in a
* space. */
- if (!is_blank_mbchar(end) && !ISSET(KILL_TRAILING_SPACES)) {
+ if (!is_blank_mbchar(end) && !ISSET(JUSTIFY_TRIM)) {
#ifndef NANO_TINY
add_undo(ADD);
#endif
@@ -2176,7 +2176,7 @@ void do_justify(bool full_justify)
#endif
/* Break the current line. */
- if (ISSET(KILL_TRAILING_SPACES)) {
+ if (ISSET(JUSTIFY_TRIM)) {
while (break_pos > 0 &&
is_blank_mbchar(&openfile->current->data[break_pos-1])) {
break_pos--;