add new -W/--wordbounds command line option, and new "wordbounds" rcfile

option, to control whether the word movement functions treat punctuation
characters as part of a word


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2983 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
David Lawrence Ramsey 2005-08-10 22:12:28 +00:00
parent 6a3ac36420
commit 4f03daff91
6 changed files with 28 additions and 6 deletions

View File

@ -148,6 +148,12 @@ CVS code -
and add an updated FAQ entry about its use. Changes to
window_init(), usage(), main(), get_verbatim_kbinput(),
nanorc.sample, and faq.html. (DLR)
- Add new -W/--wordbounds command line option, and new
"wordbounds" rcfile option, to control whether
the word movement functions treat punctuation characters as
part of a word. Changes to do_next_word_void(),
do_prev_word_void(), usage(), main(), and nanorc.sample. (DLR,
suggested by Mike Frysinger)
- color.c:
- Remove unneeded fcntl.h include. (DLR)
- chars.c:

View File

@ -144,6 +144,10 @@
## (00B7 hexadecimal) seem to be good values for these.
# set whitespace " "
## Detect word boundaries more accurately by treating punctuation
## characters as part of a word.
# set wordbounds
## Color setup
##
## Format:
@ -324,7 +328,7 @@
## highlight possible errors and parameters
# icolor brightwhite "^[[:space:]]*(set|unset|syntax|i?color).*$"
## set, unset and syntax
# icolor cyan "^[[:space:]]*(set|unset)[[:space:]]+(autoindent|backup|backupdir|backwards|brackets|casesensitive|const|cut|fill|historylog|morespace|mouse|multibuffer|noconvert|nofollow|nohelp|nowrap|operatingdir|preserve|punct|quickblank|quotestr|rebinddelete)\>" "^[[:space:]]*(set|unset)[[:space:]]+(rebindkeypad|regexp|smarthome|smooth|speller|suspend|tabsize|tabstospaces|tempfile|view|whitespace)\>"
# icolor cyan "^[[:space:]]*(set|unset)[[:space:]]+(autoindent|backup|backupdir|backwards|brackets|casesensitive|const|cut|fill|historylog|morespace|mouse|multibuffer|noconvert|nofollow|nohelp|nowrap|operatingdir|preserve|punct|quickblank|quotestr|rebinddelete)\>" "^[[:space:]]*(set|unset)[[:space:]]+(rebindkeypad|regexp|smarthome|smooth|speller|suspend|tabsize|tabstospaces|tempfile|view|whitespace|wordbounds)\>"
# icolor green "^[[:space:]]*(set|unset|syntax)\>"
## colors
# icolor yellow "^[[:space:]]*i?color[[:space:]]*(bright)?(white|black|red|blue|green|yellow|magenta|cyan)?(,(white|black|red|blue|green|yellow|magenta|cyan))?\>"

View File

@ -297,7 +297,7 @@ bool do_next_word(bool allow_punct, bool allow_update)
void do_next_word_void(void)
{
do_next_word(FALSE, TRUE);
do_next_word(ISSET(WORD_BOUNDS), TRUE);
}
/* Move to the previous word in the current filestruct. If allow_punct
@ -428,7 +428,7 @@ bool do_prev_word(bool allow_punct, bool allow_update)
void do_prev_word_void(void)
{
do_prev_word(FALSE, TRUE);
do_prev_word(ISSET(WORD_BOUNDS), TRUE);
}
#endif /* !NANO_SMALL */

View File

@ -1077,6 +1077,10 @@ void usage(void)
#endif
print1opt("-V", "--version",
N_("Print version information and exit"));
#ifndef NANO_SMALL
print1opt("-W", "--wordbounds",
N_("Detect word boundaries more accurately"));
#endif
#ifdef ENABLE_COLOR
print1opt(_("-Y [str]"), _("--syntax=[str]"),
N_("Syntax definition to use"));
@ -1918,6 +1922,7 @@ int main(int argc, char **argv)
{"noconvert", 0, NULL, 'N'},
{"smooth", 0, NULL, 'S'},
{"quickblank", 0, NULL, 'U'},
{"wordbounds", 0, NULL, 'W'},
{"autoindent", 0, NULL, 'i'},
{"cut", 0, NULL, 'k'},
#endif
@ -1958,11 +1963,11 @@ int main(int argc, char **argv)
while ((optchr =
#ifdef HAVE_GETOPT_LONG
getopt_long(argc, argv,
"h?ABC:EFHIKNOQ:RST:UVY:abcdefgijklmo:pr:s:tvwxz",
"h?ABC:EFHIKNOQ:RST:UVWY:abcdefgijklmo:pr:s:tvwxz",
long_options, NULL)
#else
getopt(argc, argv,
"h?ABC:EFHIKNOQ:RST:UVY:abcdefgijklmo:pr:s:tvwxz")
"h?ABC:EFHIKNOQ:RST:UVWY:abcdefgijklmo:pr:s:tvwxz")
#endif
) != -1) {
switch (optchr) {
@ -2042,6 +2047,11 @@ int main(int argc, char **argv)
case 'V':
version();
exit(0);
#ifndef NANO_SMALL
case 'W':
SET(WORD_BOUNDS);
break;
#endif
#ifdef ENABLE_COLOR
case 'Y':
syntaxstr = mallocstrcpy(syntaxstr, optarg);

View File

@ -313,7 +313,8 @@ typedef struct rcoption {
#define MORE_SPACE (1<<26)
#define TABS_TO_SPACES (1<<27)
#define QUICK_BLANK (1<<28)
#define USE_UTF8 (1<<29)
#define WORD_BOUNDS (1<<29)
#define USE_UTF8 (1<<30)
/* Control key sequences. Changing these would be very, very bad. */
#define NANO_CONTROL_SPACE 0

View File

@ -88,6 +88,7 @@ const static rcoption rcopts[] = {
{"smooth", SMOOTH_SCROLL},
{"tabstospaces", TABS_TO_SPACES},
{"whitespace", 0},
{"wordbounds", WORD_BOUNDS},
#endif
{NULL, 0}
};