From 5755ecdbfce3f66927924a2f0468a28e0eb7f5bf Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Sun, 12 Apr 2020 11:15:28 +0200 Subject: [PATCH] options: let --afterends affect also the deleting of words (Ctrl+Delete) It makes more sense that deletes the same thing as what would select. Suggested-by: Liu Hao --- doc/nano.1 | 2 +- doc/nano.texi | 4 ++-- doc/nanorc.5 | 2 +- doc/sample.nanorc.in | 4 ++-- src/cut.c | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/doc/nano.1 b/doc/nano.1 index 68fbedb4..c5668c89 100644 --- a/doc/nano.1 +++ b/doc/nano.1 @@ -314,7 +314,7 @@ This is the default. (This option is the opposite of \fB\-b\fR Don't show the two help lines at the bottom of the screen. .TP .BR \-y ", " \-\-afterends -Make Ctrl+Right stop at word ends instead of beginnings. +Make Ctrl+Right and Ctrl+Delete stop at word ends instead of beginnings. .TP .BR \-z ", " \-\-suspendable Allow the user to suspend the editor (with \fB^Z\fR by default). diff --git a/doc/nano.texi b/doc/nano.texi index 7c7a43f6..f39fd876 100644 --- a/doc/nano.texi +++ b/doc/nano.texi @@ -448,7 +448,7 @@ disabled to display the help-system navigation keys. @item -y @itemx --afterends -Make Ctrl+Right stop at word ends instead of beginnings. +Make Ctrl+Right and Ctrl+Delete stop at word ends instead of beginnings. @item -z @itemx --suspendable @@ -727,7 +727,7 @@ The supported settings in a nanorc file are: @table @code @item set afterends -Make Ctrl+Right stop at word ends instead of beginnings. +Make Ctrl+Right and Ctrl+Delete stop at word ends instead of beginnings. @item set allow_insecure_backup When backing up files, allow the backup to succeed even if its diff --git a/doc/nanorc.5 b/doc/nanorc.5 index fb365411..05b27449 100644 --- a/doc/nanorc.5 +++ b/doc/nanorc.5 @@ -68,7 +68,7 @@ The supported commands and arguments are: .TP 3 .B set afterends -Make Ctrl+Right stop at word ends instead of beginnings. +Make Ctrl+Right and Ctrl+Delete stop at word ends instead of beginnings. .TP .B set allow_insecure_backup When backing up files, allow the backup to succeed even if its permissions diff --git a/doc/sample.nanorc.in b/doc/sample.nanorc.in index 8ee33a40..8d0405e1 100644 --- a/doc/sample.nanorc.in +++ b/doc/sample.nanorc.in @@ -8,8 +8,8 @@ ## Inside string parameters, quotes should not be escaped -- the last ## double quote on the line will be seen as the closing quote. -## Make the 'nextword' function (Ctrl+Right) stop at word ends -## instead of at beginnings. +## Make 'nextword' (Ctrl+Right) and 'chopwordright' (Ctrl+Delete) +## stop at word ends instead of at beginnings. # set afterends ## When soft line wrapping is enabled, make it wrap lines at blanks diff --git a/src/cut.c b/src/cut.c index 1d7b203f..fbc145c3 100644 --- a/src/cut.c +++ b/src/cut.c @@ -193,7 +193,7 @@ void chop_word(bool forward) openfile->current_x = strlen(openfile->current->data); } } else { - do_next_word(FALSE, ISSET(WORD_BOUNDS)); + do_next_word(ISSET(AFTER_ENDS), ISSET(WORD_BOUNDS)); if (openfile->current != is_current && is_current->data[is_current_x] != '\0') { openfile->current = is_current;