]> git.wh0rd.org Git - nano.git/commitdiff
add new -W/--wordbounds command line option, and new "wordbounds" rcfile
authorDavid Lawrence Ramsey <pooka109@gmail.com>
Wed, 10 Aug 2005 22:12:28 +0000 (22:12 +0000)
committerDavid Lawrence Ramsey <pooka109@gmail.com>
Wed, 10 Aug 2005 22:12:28 +0000 (22:12 +0000)
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

ChangeLog
doc/nanorc.sample
src/move.c
src/nano.c
src/nano.h
src/rcfile.c

index 306e2b90f8d1082ea2e2772df79a4590002d8689..c7f9f94414bcfb8564e8d6c51d752cb66c5ff153 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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:
index bd772fa5d5681eaa960b29ae54c7a38e538f516d..135e6ea875f817a2914c3729910d0bf47b5ec892 100644 (file)
 ## (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:
 ## 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))?\>"
index 69b6b6cb451898fc6426e44938899054bc20f260..b982f222173167056af71cfa62baddd2589ab35b 100644 (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 */
 
index b1900925b734ce2b301eace51013af151c9999bc..1998ea9fa5f2e8116516bea6c05b26c2f77b01c2 100644 (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);
index 945b4e3aaaeb6b4ac4a16a76354566e81587cdcd..61b8d307195da251c1347463fdbaecebdb18c588 100644 (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
index ec356349ee4065d37e1207a359453f64d79a03cc..d5140c603f6a3d47b431c6488dd82b3473503cb3 100644 (file)
@@ -88,6 +88,7 @@ const static rcoption rcopts[] = {
     {"smooth", SMOOTH_SCROLL},
     {"tabstospaces", TABS_TO_SPACES},
     {"whitespace", 0},
+    {"wordbounds", WORD_BOUNDS},
 #endif
     {NULL, 0}
 };