]> granicus.if.org Git - vim/commitdiff
updated for version 7.0011 v7.0011
authorBram Moolenaar <Bram@vim.org>
Mon, 19 Jul 2004 20:55:54 +0000 (20:55 +0000)
committerBram Moolenaar <Bram@vim.org>
Mon, 19 Jul 2004 20:55:54 +0000 (20:55 +0000)
18 files changed:
runtime/doc/eval.txt
runtime/doc/os_mac.txt
runtime/doc/tags
runtime/doc/todo.txt
runtime/doc/version7.txt
runtime/syntax/sql.vim
runtime/syntax/wsh.vim
src/Make_mvc.mak
src/eval.c
src/gui_mac.c
src/misc2.c
src/proto/misc2.pro
src/testdir/Makefile
src/testdir/test37.in
src/testdir/test44.in
src/testdir/test44.ok
src/testdir/test53.in
src/testdir/test53.ok

index 400eb76a567f72b7068b4283c190ba77ace811c1..0e68dfa7e3b66b141117e3f088f43a614753bfec 100644 (file)
@@ -1,4 +1,4 @@
-*eval.txt*      For Vim version 7.0aa.  Last change: 2004 Jul 18
+*eval.txt*      For Vim version 7.0aa.  Last change: 2004 Jul 19
 
 
                  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -831,6 +831,8 @@ executable( {expr})         Number  1 if executable {expr} exists
 exists( {expr})                        Number  TRUE if {expr} exists
 expand( {expr})                        String  expand special keywords in {expr}
 filereadable( {file})          Number  TRUE if {file} is a readable file
+findfile( {name}[, {path}[, {count}]])
+                               String  Find fine {name} in {path}
 filewritable( {file})          Number  TRUE if {file} is a writable file
 fnamemodify( {fname}, {mods})  String  modify file name
 foldclosed( {lnum})            Number  first line of fold at {lnum} if closed
@@ -879,12 +881,12 @@ lispindent( {lnum})               Number  Lisp indent for line {lnum}
 localtime()                    Number  current time
 maparg( {name}[, {mode}])      String  rhs of mapping {name} in mode {mode}
 mapcheck( {name}[, {mode}])    String  check for mappings matching {name}
-match( {expr}, {pat}[, {start}])
+match( {expr}, {pat}[, {start}[, {count}]])
                                Number  position where {pat} matches in {expr}
-matchend( {expr}, {pat}[, {start}])
+matchend( {expr}, {pat}[, {start}[, {count}]])
                                Number  position where {pat} ends in {expr}
-matchstr( {expr}, {pat}[, {start}])
-                               String  match of {pat} in {expr}
+matchstr( {expr}, {pat}[, {start}[, {count}]])
+                               String  {count}'th match of {pat} in {expr}
 mode()                         String  current editing mode
 nextnonblank( {lnum})          Number  line nr of non-blank line >= {lnum}
 nr2char( {expr})               String  single char with ASCII value {expr}
@@ -1412,6 +1414,23 @@ filereadable({file})                                     *filereadable()*
                                                        *file_readable()*
                Obsolete name: file_readable().
 
+finddir({name}[, {path}[, {count}]])                           *finddir()*
+               Find directory {name} in {path}.
+               If {path} is omitted or empty then 'path' is used.
+               If the optional {count} is given, find {count}'s occurrence of
+               {name} in {path}.
+               This is quite similar to the ex-command |:find|.
+               When the found directory is below the current directory a
+               relative path is returned.  Otherwise a full path is returned.
+               Example: >
+                       :echo findfile("tags.vim", ".;")
+<              Searches from the current directory upwards until it finds
+               the file "tags.vim".
+               {only available when compiled with the +file_in_path feature}
+
+findfile({name}[, {path}[, {count}]])                          *findfile()*
+               Just like |finddir()|, but find a file instead of a directory.
+
 filewritable({file})                                   *filewritable()*
                The result is a Number, which is 1 when a file with the
                name {file} exists, and can be written.  If {file} doesn't
@@ -2027,14 +2046,20 @@ mapcheck({name}[, {mode}])                              *mapcheck()*
 <              This avoids adding the "_vv" mapping when there already is a
                mapping for "_v" or for "_vvv".
 
-match({expr}, {pat}[, {start}])                                *match()*
+match({expr}, {pat}[, {start}[, {count}]])                     *match()*
                The result is a Number, which gives the index (byte offset) in
-               {expr} where {pat} matches.  A match at the first character
-               returns zero.  If there is no match -1 is returned.  Example: >
+               {expr} where {pat} matches.
+               A match at the first character returns zero.
+               If there is no match -1 is returned.
+               Example: >
                        :echo match("testing", "ing")
 <              results in "4".
                See |string-match| for how {pat} is used.
-               If {start} is given, the search starts from index {start}.
+               When {count} is given use the {count}'th match.  When a match
+               is found the search for the next one starts on character
+               further.  Thus this example results in 1: >
+                       echo match("testing", "..", 0, 2)
+<              If {start} is given, the search starts from index {start}.
                The result, however, is still the index counted from the
                first character. Example: >
                        :echo match("testing", "ing", 2)
@@ -2050,7 +2075,7 @@ match({expr}, {pat}[, {start}])                           *match()*
                the pattern.  'smartcase' is NOT used.  The matching is always
                done like 'magic' is set and 'cpoptions' is empty.
 
-matchend({expr}, {pat}[, {start}])                     *matchend()*
+matchend({expr}, {pat}[, {start}[, {count}]])                  *matchend()*
                Same as match(), but return the index of first character after
                the match.  Example: >
                        :echo matchend("testing", "ing")
@@ -2061,7 +2086,7 @@ matchend({expr}, {pat}[, {start}])                        *matchend()*
                        :echo matchend("testing", "ing", 5)
 <              result is "-1".
 
-matchstr({expr}, {pat}[, {start}])                     *matchstr()*
+matchstr({expr}, {pat}[, {start}[, {count}]])                  *matchstr()*
                Same as match(), but return the matched string.  Example: >
                        :echo matchstr("testing", "ing")
 <              results in "ing".
index f242552453468cab6192f74cd4301ebbb606bcf4..91eb64109a1754e08e8486ece597c48da37a7ecb 100644 (file)
@@ -1,4 +1,4 @@
-*os_mac.txt*    For Vim version 7.0aa.  Last change: 2004 Jun 19
+*os_mac.txt*    For Vim version 7.0aa.  Last change: 2004 Jul 19
 
 
                  VIM REFERENCE MANUAL    by Bram Moolenaar et al.
@@ -9,7 +9,7 @@
 This file documents the particularities of the Macintosh version of Vim.
 
 NOTE: This file is a bit outdated.  You might find more useful info here:
-       http://macvim.swdev.org/
+       http://macvim.org/
 
 1. Filename Convention         |mac-filename|
 2. .vimrc an .vim files                |mac-vimfile|
index e44ac444f7b6cedab46eb49f79028a2a97b40a71..528b8a932299250f1ea36f7c7c1c968cf41ceec4 100644 (file)
@@ -4065,6 +4065,7 @@ builtin-tools     gui.txt /*builtin-tools*
 builtin_terms  term.txt        /*builtin_terms*
 byte-count     editing.txt     /*byte-count*
 byte2line()    eval.txt        /*byte2line()*
+byteidx()      eval.txt        /*byteidx()*
 bzip2  pi_gzip.txt     /*bzip2*
 c      change.txt      /*c*
 c-syntax       syntax.txt      /*c-syntax*
@@ -4624,6 +4625,7 @@ filewritable()    eval.txt        /*filewritable()*
 filter change.txt      /*filter*
 find-manpage   usr_12.txt      /*find-manpage*
 find-replace   usr_10.txt      /*find-replace*
+findfile()     eval.txt        /*findfile()*
 fixed-5.1      version5.txt    /*fixed-5.1*
 fixed-5.2      version5.txt    /*fixed-5.2*
 fixed-5.3      version5.txt    /*fixed-5.3*
index ba4af3ef0720d11b8a7a58ba1cd4f63a62b0e257..9f3b61595452279b64b87e6b3d695341e9a63367 100644 (file)
@@ -1,4 +1,4 @@
-*todo.txt*      For Vim version 7.0aa.  Last change: 2004 Jul 18
+*todo.txt*      For Vim version 7.0aa.  Last change: 2004 Jul 19
 
 
                  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -36,11 +36,6 @@ Add fix for zh_cn to Vim 6.3?  (Liang)
 For version 7.0:
 -   Include many PATCHES:
     8   Add functions:
-       match({pat}, {string} [,start] [,count]) get index of count'th match
-                               Patch by Ilya Sher, 2004 Jun 19
-       find()                  find file in 'path' (patch from Johannes
-                               Zellner 2001 Dec 20)
-                               Update 2004 Jun 16.
        realname()              Get user name (first, last, full)
                                user_fullname() patch by Nikolai Weibull, Nov
                                3 2002)
index a7f7d1997cfa472ba3d12410b010efec85807084..006245f6b2a4582ffa42fb609211a42b7d6c97eb 100644 (file)
@@ -1,4 +1,4 @@
-*version7.txt*  For Vim version 7.0aa.  Last change: 2004 Jul 18
+*version7.txt*  For Vim version 7.0aa.  Last change: 2004 Jul 19
 
 
                  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -123,10 +123,13 @@ Win32: The ":winpos" command now also works in the console. (Vipin Aravind)
 
 New functions: ~
 
+byteidx(expr, nr)      |byteidx()|     Index of a character. (Ilya Sher)
+finddir(name)          |finddir()|     Find a directory in 'path'.
+findfile(name)         |findfile()|    Find a file in 'path'. (Johannes
+                                       Zellner)
 repeat(expr, count)    |repeat()|      Repeat "expr" "count" times.
                                        (Christophe Poucet)
 tr(expr, from, to)     |tr()|          Translate characters. (Ron Aaron)
-byteidx(expr, nr)      |byteidx()|     Index of a character. (Ilya Sher)
 
 
 New autocommand events: ~
@@ -182,6 +185,8 @@ For lisp indenting and matching parenthesis: (Sergey Khorev)
 - #\(, #\), #\[ and #\] are recognized as character literals
 - Lisp line comments (delimited by semicolon) are recognized
 
+Added the "count" argument to match(), matchend() and matchstr(). (Ilya Sher)
+
 ==============================================================================
 COMPILE TIME CHANGES                                   *compile-changes-7*
 
index 9083b81366fa7b7a3f22c4c25d3afe717c415b5d..6d8bca356306bef48b774e9d7af8530fba7f49ad 100644 (file)
@@ -1,7 +1,7 @@
 " Vim syntax file
 " Language:    SQL, PL/SQL (Oracle 8i)
-" Maintainer:  Paul Moore <gustav@morpheus.demon.co.uk>
-" Last Change: 2001 Apr 30
+" Maintainer:  Paul Moore <pf_moore AT yahoo.co.uk>
+" Last Change: 2004 Jul 19
 
 " For version 5.x: Clear all syntax items
 " For version 6.x: Quit when a syntax file was already loaded
index 98ba105a727328b3fc1645c261055f036c24cb10..4b664a177e5b95e97e9dd0ad8322434edafecee3 100644 (file)
@@ -1,6 +1,6 @@
 " Vim syntax file
 " Language:    Windows Scripting Host
-" Maintainer:  Paul Moore <gustav@morpheus.demon.co.uk>
+" Maintainer:  Paul Moore <pf_moore AT yahoo.co.uk>
 " Last Change: Fre, 24 Nov 2000 21:54:09 +0100
 
 " This reuses the XML, VB and JavaScript syntax files. While VB is not
index 23e69975cca9d68ee91bcece9d72a035dd790c36..63a99f22091cbeebbb7d92c1baaa6311a0dc74c5 100644 (file)
@@ -852,13 +852,17 @@ $(OUTDIR)/dimm_i.obj: $(OUTDIR) dimm_i.c $(INCL)
 
 $(OUTDIR)/glbl_ime.obj:        $(OUTDIR) glbl_ime.cpp  dimm.h $(INCL)
 
+# $CFLAGS may contain backslashes and double quotes, escape them both.
+E0_CFLAGS = $(CFLAGS:\=\\)
+E_CFLAGS = $(E0_CFLAGS:"=\")
+
 auto/pathdef.c: auto
        @echo creating auto/pathdef.c
        @echo /* pathdef.c */ > auto\pathdef.c
        @echo #include "vim.h" >> auto\pathdef.c
        @echo char_u *default_vim_dir = (char_u *)"$(VIMRCLOC:\=\\)"; >> auto\pathdef.c
        @echo char_u *default_vimruntime_dir = (char_u *)"$(VIMRUNTIMEDIR:\=\\)"; >> auto\pathdef.c
-       @echo char_u *all_cflags = (char_u *)"$(CC:\=\\) $(CFLAGS:\=\\)"; >> auto\pathdef.c
+       @echo char_u *all_cflags = (char_u *)"$(CC:\=\\) $(E_CFLAGS)"; >> auto\pathdef.c
        @echo char_u *all_lflags = (char_u *)"$(link:\=\\) $(LINKARGS1:\=\\) $(LINKARGS2:\=\\)"; >> auto\pathdef.c
        @echo char_u *compiled_user = (char_u *)"$(USERNAME)"; >> auto\pathdef.c
        @echo char_u *compiled_sys = (char_u *)"$(USERDOMAIN)"; >> auto\pathdef.c
index 21c10fd67c720cca7e178777bf88fdd720a718cc..b2955ff11c9c9408f38a07f4ece7a26e146eeb98 100644 (file)
@@ -279,6 +279,9 @@ static void f_exists __ARGS((VAR argvars, VAR retvar));
 static void f_expand __ARGS((VAR argvars, VAR retvar));
 static void f_filereadable __ARGS((VAR argvars, VAR retvar));
 static void f_filewritable __ARGS((VAR argvars, VAR retvar));
+static void f_finddir __ARGS((VAR argvars, VAR retvar));
+static void f_findfile __ARGS((VAR argvars, VAR retvar));
+static void f_findfilendir __ARGS((VAR argvars, VAR retvar, int dir));
 static void f_fnamemodify __ARGS((VAR argvars, VAR retvar));
 static void f_foldclosed __ARGS((VAR argvars, VAR retvar));
 static void f_foldclosedend __ARGS((VAR argvars, VAR retvar));
@@ -2836,6 +2839,8 @@ static struct fst
     {"file_readable",  1, 1, f_filereadable},  /* obsolete */
     {"filereadable",   1, 1, f_filereadable},
     {"filewritable",   1, 1, f_filewritable},
+    {"finddir",                1, 3, f_finddir},
+    {"findfile",       1, 3, f_findfile},
     {"fnamemodify",    2, 2, f_fnamemodify},
     {"foldclosed",     1, 1, f_foldclosed},
     {"foldclosedend",  1, 1, f_foldclosedend},
@@ -2886,9 +2891,9 @@ static struct fst
     {"localtime",      0, 0, f_localtime},
     {"maparg",         1, 2, f_maparg},
     {"mapcheck",       1, 2, f_mapcheck},
-    {"match",          2, 3, f_match},
-    {"matchend",       2, 3, f_matchend},
-    {"matchstr",       2, 3, f_matchstr},
+    {"match",          2, 4, f_match},
+    {"matchend",       2, 4, f_matchend},
+    {"matchstr",       2, 4, f_matchstr},
     {"mode",           0, 0, f_mode},
     {"nextnonblank",   1, 1, f_nextnonblank},
     {"nr2char",                1, 1, f_nr2char},
@@ -4167,6 +4172,71 @@ f_filewritable(argvars, retvar)
     retvar->var_val.var_number = retval;
 }
 
+/*
+ * "finddir({fname}[, {path}[, {count}]])" function
+ */
+    static void
+f_finddir(argvars, retvar)
+    VAR                argvars;
+    VAR                retvar;
+{
+    f_findfilendir(argvars, retvar, TRUE);
+}
+
+/*
+ * "findfile({fname}[, {path}[, {count}]])" function
+ */
+    static void
+f_findfile(argvars, retvar)
+    VAR                argvars;
+    VAR                retvar;
+{
+    f_findfilendir(argvars, retvar, FALSE);
+}
+
+    static void
+f_findfilendir(argvars, retvar, dir)
+    VAR                argvars;
+    VAR                retvar;
+    int                dir;
+{
+#ifdef FEAT_SEARCHPATH
+    char_u     *fname;
+    char_u     *fresult = NULL;
+    char_u     *path = *curbuf->b_p_path == NUL ? p_path : curbuf->b_p_path;
+    char_u     *p;
+    char_u     pathbuf[NUMBUFLEN];
+    int                count = 1;
+    int                first = TRUE;
+
+    fname = get_var_string(&argvars[0]);
+
+    if (argvars[1].var_type != VAR_UNKNOWN)
+    {
+       p = get_var_string_buf(&argvars[1], pathbuf);
+       if (*p != NUL)
+           path = p;
+
+       if (argvars[2].var_type != VAR_UNKNOWN)
+           count = get_var_number(&argvars[2]);
+    }
+
+    do
+    {
+       vim_free(fresult);
+       fresult = find_file_in_path_option(first ? fname : NULL,
+                                           first ? (int)STRLEN(fname) : 0,
+                                           0, first, path, dir, NULL);
+       first = FALSE;
+    } while (--count > 0 && fresult != NULL);
+
+    retvar->var_val.var_string = fresult;
+#else
+    retvar->var_val.var_string = NULL;
+#endif
+    retvar->var_type = VAR_STRING;
+}
+
 /*
  * "fnamemodify({fname}, {mods})" function
  */
@@ -5858,17 +5928,20 @@ find_some_match(argvars, retvar, type)
     int                type;
 {
     char_u     *str;
+    char_u     *expr;
     char_u     *pat;
     regmatch_T regmatch;
     char_u     patbuf[NUMBUFLEN];
     char_u     *save_cpo;
     long       start = 0;
+    long       nth = 1;
+    int                match;
 
     /* Make 'cpoptions' empty, the 'l' flag should not be used here. */
     save_cpo = p_cpo;
     p_cpo = (char_u *)"";
 
-    str = get_var_string(&argvars[0]);
+    expr = str = get_var_string(&argvars[0]);
     pat = get_var_string_buf(&argvars[1], patbuf);
 
     if (type == 2)
@@ -5887,13 +5960,30 @@ find_some_match(argvars, retvar, type)
        if (start > (long)STRLEN(str))
            goto theend;
        str += start;
+
+       if (argvars[3].var_type != VAR_UNKNOWN)
+           nth = get_var_number(&argvars[3]);
     }
 
     regmatch.regprog = vim_regcomp(pat, RE_MAGIC + RE_STRING);
     if (regmatch.regprog != NULL)
     {
        regmatch.rm_ic = p_ic;
-       if (vim_regexec_nl(&regmatch, str, (colnr_T)0))
+
+       while (1)
+       {
+           match = vim_regexec_nl(&regmatch, str, (colnr_T)0);
+           if (!match || --nth <= 0)
+               break;
+           /* Advance to just after the match. */
+#ifdef FEAT_MBYTE
+           str = regmatch.startp[0] + mb_ptr2len_check(regmatch.startp[0]);
+#else
+           str = regmatch.startp[0] + 1;
+#endif
+       }
+
+       if (match)
        {
            if (type == 2)
                retvar->var_val.var_string = vim_strnsave(regmatch.startp[0],
@@ -5906,7 +5996,7 @@ find_some_match(argvars, retvar, type)
                else
                    retvar->var_val.var_number =
                                        (varnumber_T)(regmatch.endp[0] - str);
-               retvar->var_val.var_number += start;
+               retvar->var_val.var_number += str - expr;
            }
        }
        vim_free(regmatch.regprog);
index cf7da539b4468ac2f33ece3645c8794dcea1fa37..645e0b5b876bf96910632c59fded1a33e4f22fe2 100644 (file)
@@ -4251,12 +4251,12 @@ clip_mch_request_selection(cbd)
 {
 
     Handle     textOfClip;
+    int                flavor = 0;
 #ifdef USE_CARBONIZED
     Size       scrapSize;
     ScrapFlavorFlags   scrapFlags;
     ScrapRef    scrap = nil;
     OSStatus   error;
-    int                flavor;
 #else
     long       scrapOffset;
     long       scrapSize;
@@ -4271,7 +4271,6 @@ clip_mch_request_selection(cbd)
     if (error != noErr)
        return;
 
-    flavor = 0;
     error = GetScrapFlavorFlags(scrap, VIMSCRAPFLAVOR, &scrapFlags);
     if (error == noErr)
     {
@@ -4315,15 +4314,16 @@ clip_mch_request_selection(cbd)
 #else
        scrapSize = GetScrap(textOfClip, 'TEXT', &scrapOffset);
 #endif
+       scrapSize -= flavor;
 
        if (flavor)
            type = **textOfClip;
        else
            type = (strchr(*textOfClip, '\r') != NULL) ? MLINE : MCHAR;
 
-       tempclip = lalloc(scrapSize+1, TRUE);
-       STRNCPY(tempclip, *textOfClip + flavor, scrapSize - flavor);
-       tempclip[scrapSize - flavor] = 0;
+       tempclip = lalloc(scrapSize + 1, TRUE);
+       STRNCPY(tempclip, *textOfClip + flavor, scrapSize);
+       tempclip[scrapSize] = 0;
 
        searchCR = (char *)tempclip;
        while (searchCR != NULL)
index 817f56d62860048015326b48269028f701daf890..dbc5166c837bb2facc33809df1051bb3cab8f227 100644 (file)
@@ -3457,10 +3457,6 @@ static ff_stack_T *ff_create_stack_element __ARGS((char_u *, int, int));
 static int ff_path_in_stoplist __ARGS((char_u *, int, char_u **));
 #endif
 
-#ifdef FEAT_SEARCHPATH
-static char_u *find_file_in_path_option __ARGS((char_u *ptr, int len, int options, int first, char_u *path_option, int need_dir, char_u *rel_fname));
-#endif
-
 #if 0
 /*
  * if someone likes findfirst/findnext, here are the functions
@@ -4860,7 +4856,7 @@ find_directory_in_path(ptr, len, options, rel_fname)
                                                             TRUE, rel_fname);
 }
 
-    static char_u *
+    char_u *
 find_file_in_path_option(ptr, len, options, first, path_option, need_dir, rel_fname)
     char_u     *ptr;           /* file name */
     int                len;            /* length of file name */
index a04154a8b13dcded30fc26608709109561c276a1..6419740b403a63db3bd6f8db006ff2bdce65f76f 100644 (file)
@@ -82,6 +82,7 @@ char_u *vim_findfile __ARGS((void *search_ctx));
 void vim_findfile_free_visited __ARGS((void *search_ctx));
 char_u *find_file_in_path __ARGS((char_u *ptr, int len, int options, int first, char_u *rel_fname));
 char_u *find_directory_in_path __ARGS((char_u *ptr, int len, int options, char_u *rel_fname));
+char_u *find_file_in_path_option __ARGS((char_u *ptr, int len, int options, int first, char_u *path_option, int need_dir, char_u *rel_fname));
 int vim_chdir __ARGS((char_u *new_dir));
 int get_user_name __ARGS((char_u *buf, int len));
 void sort_strings __ARGS((char_u **files, int count));
index b09db81bada032c44dc01507f2197130b009ed80..57de3ab23c58b61ad51966f453398258ffda5a03 100644 (file)
@@ -32,7 +32,7 @@ gui:  nolog $(SCRIPTS) $(SCRIPTS_GUI)
 $(SCRIPTS) $(SCRIPTS_GUI): $(VIMPROG)
 
 clean:
-       -rm -rf *.out *.rej *.orig test.log tiny.vim small.vim mbyte.vim test.ok X* viminfo
+       -rm -rf *.out *.failed *.rej *.orig test.log tiny.vim small.vim mbyte.vim test.ok X* viminfo
 
 test1.out: test1.in
        -rm -f $*.failed tiny.vim small.vim mbyte.vim test.ok X* viminfo
index daaea32d0966b6b71a8d4bf00dddcd8edbba8c85..8ca11257933692f8a59c776e4e82087730eeea98 100644 (file)
@@ -1,4 +1,4 @@
-Test for 'scrollbind'. <eralston@computer.org>
+Test for 'scrollbind'. <eralston@computer.org>   Do not add a line below!
 STARTTEST
 :so small.vim
 :set noscrollbind
index d90a962d31ec4f798b913d0d8babb3594dfe7541..2748e3d01539d15fe53dd957ba09b9fc7bf6b2ed 100644 (file)
@@ -1,4 +1,5 @@
 Tests for regexp with multi-byte encoding and various magic settings.
+Test matchstr() with a count and multi-byte chars.
 
 STARTTEST
 :so mbyte.vim
@@ -21,6 +22,12 @@ x:" Now search for multi-byte with composing char
 x:" find word by change of word class
 /ち\<カヨ\>は
 x:?^1?,$w! test.out
+:e! test.out
+G:put =matchstr(\"אבגד\", \".\", 0, 2) " ב
+:put =matchstr(\"אבגד\", \"..\", 0, 2) " בג
+:put =matchstr(\"אבגד\", \".\", 0, 0) " א
+:put =matchstr(\"אבגד\", \".\", 4, -1) " ג
+:w!
 :qa!
 ENDTEST
 
index af8507606af09ba585d40f7f17dd4b3861a81e15..86f79d47ce79ffd7c7c25b1b12451c69f860aab7 100644 (file)
@@ -9,3 +9,7 @@
 9 หม่x อx
 a อมx หx
 b カヨは
+בג
index d2c0ad51baf423b83d8ed4e076b6432213aacf0d..29f7a70bdf2e6bf08bcf2f409cab0fbf5413699f 100644 (file)
@@ -1,5 +1,9 @@
 Tests for string text objects. vim: set ft=vim :
 
+Note that the end-of-line moves the cursor to the next test line.
+
+Also test match() and matchstr()
+
 STARTTEST
 :so small.vim
 /^start:/
@@ -11,6 +15,12 @@ da"
 :set quoteescape=+*-
 di`
 $F"va"oha"i"rz
+k:put =matchstr(\"abcd\", \".\", 0, 2) " b
+:put =matchstr(\"abcd\", \"..\", 0, 2) " bc
+:put =matchstr(\"abcd\", \".\", 2, 0) " c (zero and negative -> first match)
+:put =matchstr(\"abcd\", \".\", 0, -1) " a
+:put =match(\"abcd\", \".\", 0, 5) " -1
+:put =match(\"abcd\", \".\", 0, -1) " 0
 :/^start:/,/^end:/wq! test.out
 ENDTEST
 
index 577bad12465d84b8ac7636706d249c1574efaae1..7cbd6e7314296909bdff30f56276e0b2dcb505ed 100644 (file)
@@ -5,4 +5,10 @@ out " in ""
 "'" 'blah'yyyyy'buh'
 bla `` b`la
 voo "zzzzzzzzzzzzzzzzzzzzzzzzzzzzsd
+b
+bc
+c
+a
+-1
+0
 end: