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
Этот коммит содержится в:
родитель
6a3ac36420
Коммит
4f03daff91
@ -148,6 +148,12 @@ CVS code -
|
|||||||
and add an updated FAQ entry about its use. Changes to
|
and add an updated FAQ entry about its use. Changes to
|
||||||
window_init(), usage(), main(), get_verbatim_kbinput(),
|
window_init(), usage(), main(), get_verbatim_kbinput(),
|
||||||
nanorc.sample, and faq.html. (DLR)
|
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:
|
- color.c:
|
||||||
- Remove unneeded fcntl.h include. (DLR)
|
- Remove unneeded fcntl.h include. (DLR)
|
||||||
- chars.c:
|
- chars.c:
|
||||||
|
@ -144,6 +144,10 @@
|
|||||||
## (00B7 hexadecimal) seem to be good values for these.
|
## (00B7 hexadecimal) seem to be good values for these.
|
||||||
# set whitespace " "
|
# set whitespace " "
|
||||||
|
|
||||||
|
## Detect word boundaries more accurately by treating punctuation
|
||||||
|
## characters as part of a word.
|
||||||
|
# set wordbounds
|
||||||
|
|
||||||
## Color setup
|
## Color setup
|
||||||
##
|
##
|
||||||
## Format:
|
## Format:
|
||||||
@ -324,7 +328,7 @@
|
|||||||
## highlight possible errors and parameters
|
## highlight possible errors and parameters
|
||||||
# icolor brightwhite "^[[:space:]]*(set|unset|syntax|i?color).*$"
|
# icolor brightwhite "^[[:space:]]*(set|unset|syntax|i?color).*$"
|
||||||
## set, unset and syntax
|
## 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)\>"
|
# icolor green "^[[:space:]]*(set|unset|syntax)\>"
|
||||||
## colors
|
## colors
|
||||||
# icolor yellow "^[[:space:]]*i?color[[:space:]]*(bright)?(white|black|red|blue|green|yellow|magenta|cyan)?(,(white|black|red|blue|green|yellow|magenta|cyan))?\>"
|
# icolor yellow "^[[:space:]]*i?color[[:space:]]*(bright)?(white|black|red|blue|green|yellow|magenta|cyan)?(,(white|black|red|blue|green|yellow|magenta|cyan))?\>"
|
||||||
|
@ -297,7 +297,7 @@ bool do_next_word(bool allow_punct, bool allow_update)
|
|||||||
|
|
||||||
void do_next_word_void(void)
|
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
|
/* 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)
|
void do_prev_word_void(void)
|
||||||
{
|
{
|
||||||
do_prev_word(FALSE, TRUE);
|
do_prev_word(ISSET(WORD_BOUNDS), TRUE);
|
||||||
}
|
}
|
||||||
#endif /* !NANO_SMALL */
|
#endif /* !NANO_SMALL */
|
||||||
|
|
||||||
|
14
src/nano.c
14
src/nano.c
@ -1077,6 +1077,10 @@ void usage(void)
|
|||||||
#endif
|
#endif
|
||||||
print1opt("-V", "--version",
|
print1opt("-V", "--version",
|
||||||
N_("Print version information and exit"));
|
N_("Print version information and exit"));
|
||||||
|
#ifndef NANO_SMALL
|
||||||
|
print1opt("-W", "--wordbounds",
|
||||||
|
N_("Detect word boundaries more accurately"));
|
||||||
|
#endif
|
||||||
#ifdef ENABLE_COLOR
|
#ifdef ENABLE_COLOR
|
||||||
print1opt(_("-Y [str]"), _("--syntax=[str]"),
|
print1opt(_("-Y [str]"), _("--syntax=[str]"),
|
||||||
N_("Syntax definition to use"));
|
N_("Syntax definition to use"));
|
||||||
@ -1918,6 +1922,7 @@ int main(int argc, char **argv)
|
|||||||
{"noconvert", 0, NULL, 'N'},
|
{"noconvert", 0, NULL, 'N'},
|
||||||
{"smooth", 0, NULL, 'S'},
|
{"smooth", 0, NULL, 'S'},
|
||||||
{"quickblank", 0, NULL, 'U'},
|
{"quickblank", 0, NULL, 'U'},
|
||||||
|
{"wordbounds", 0, NULL, 'W'},
|
||||||
{"autoindent", 0, NULL, 'i'},
|
{"autoindent", 0, NULL, 'i'},
|
||||||
{"cut", 0, NULL, 'k'},
|
{"cut", 0, NULL, 'k'},
|
||||||
#endif
|
#endif
|
||||||
@ -1958,11 +1963,11 @@ int main(int argc, char **argv)
|
|||||||
while ((optchr =
|
while ((optchr =
|
||||||
#ifdef HAVE_GETOPT_LONG
|
#ifdef HAVE_GETOPT_LONG
|
||||||
getopt_long(argc, argv,
|
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)
|
long_options, NULL)
|
||||||
#else
|
#else
|
||||||
getopt(argc, argv,
|
getopt(argc, argv,
|
||||||
"h?ABC:EFHIKNOQ:RST:UVY:abcdefgijklmo:pr:s:tvwxz")
|
"h?ABC:EFHIKNOQ:RST:UVWY:abcdefgijklmo:pr:s:tvwxz")
|
||||||
#endif
|
#endif
|
||||||
) != -1) {
|
) != -1) {
|
||||||
switch (optchr) {
|
switch (optchr) {
|
||||||
@ -2042,6 +2047,11 @@ int main(int argc, char **argv)
|
|||||||
case 'V':
|
case 'V':
|
||||||
version();
|
version();
|
||||||
exit(0);
|
exit(0);
|
||||||
|
#ifndef NANO_SMALL
|
||||||
|
case 'W':
|
||||||
|
SET(WORD_BOUNDS);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
#ifdef ENABLE_COLOR
|
#ifdef ENABLE_COLOR
|
||||||
case 'Y':
|
case 'Y':
|
||||||
syntaxstr = mallocstrcpy(syntaxstr, optarg);
|
syntaxstr = mallocstrcpy(syntaxstr, optarg);
|
||||||
|
@ -313,7 +313,8 @@ typedef struct rcoption {
|
|||||||
#define MORE_SPACE (1<<26)
|
#define MORE_SPACE (1<<26)
|
||||||
#define TABS_TO_SPACES (1<<27)
|
#define TABS_TO_SPACES (1<<27)
|
||||||
#define QUICK_BLANK (1<<28)
|
#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. */
|
/* Control key sequences. Changing these would be very, very bad. */
|
||||||
#define NANO_CONTROL_SPACE 0
|
#define NANO_CONTROL_SPACE 0
|
||||||
|
@ -88,6 +88,7 @@ const static rcoption rcopts[] = {
|
|||||||
{"smooth", SMOOTH_SCROLL},
|
{"smooth", SMOOTH_SCROLL},
|
||||||
{"tabstospaces", TABS_TO_SPACES},
|
{"tabstospaces", TABS_TO_SPACES},
|
||||||
{"whitespace", 0},
|
{"whitespace", 0},
|
||||||
|
{"wordbounds", WORD_BOUNDS},
|
||||||
#endif
|
#endif
|
||||||
{NULL, 0}
|
{NULL, 0}
|
||||||
};
|
};
|
||||||
|
Загрузка…
Ссылка в новой задаче
Block a user