comparison src/ex_docmd.c @ 17488:bba80d61ea73 v8.1.1742

patch 8.1.1742: still some match functions in evalfunc.c commit https://github.com/vim/vim/commit/7dfb016d25e3e3e1f4411026dda21d1536f21acc Author: Bram Moolenaar <Bram@vim.org> Date: Wed Jul 24 16:00:39 2019 +0200 patch 8.1.1742: still some match functions in evalfunc.c Problem: Still some match functions in evalfunc.c. Solution: Move them to highlight.c.
author Bram Moolenaar <Bram@vim.org>
date Wed, 24 Jul 2019 16:15:05 +0200
parents cfdef48743ed
children c8152af9fa33
comparison
equal deleted inserted replaced
17487:a9fd9cb70c4f 17488:bba80d61ea73
337 #if !defined(FEAT_EVAL) 337 #if !defined(FEAT_EVAL)
338 # define ex_options ex_ni 338 # define ex_options ex_ni
339 #endif 339 #endif
340 #ifdef FEAT_SEARCH_EXTRA 340 #ifdef FEAT_SEARCH_EXTRA
341 static void ex_nohlsearch(exarg_T *eap); 341 static void ex_nohlsearch(exarg_T *eap);
342 static void ex_match(exarg_T *eap);
343 #else 342 #else
344 # define ex_nohlsearch ex_ni 343 # define ex_nohlsearch ex_ni
345 # define ex_match ex_ni 344 # define ex_match ex_ni
346 #endif 345 #endif
347 #ifdef FEAT_CRYPT 346 #ifdef FEAT_CRYPT
10949 ex_nohlsearch(exarg_T *eap UNUSED) 10948 ex_nohlsearch(exarg_T *eap UNUSED)
10950 { 10949 {
10951 set_no_hlsearch(TRUE); 10950 set_no_hlsearch(TRUE);
10952 redraw_all_later(SOME_VALID); 10951 redraw_all_later(SOME_VALID);
10953 } 10952 }
10954
10955 /*
10956 * ":[N]match {group} {pattern}"
10957 * Sets nextcmd to the start of the next command, if any. Also called when
10958 * skipping commands to find the next command.
10959 */
10960 static void
10961 ex_match(exarg_T *eap)
10962 {
10963 char_u *p;
10964 char_u *g = NULL;
10965 char_u *end;
10966 int c;
10967 int id;
10968
10969 if (eap->line2 <= 3)
10970 id = eap->line2;
10971 else
10972 {
10973 emsg(_(e_invcmd));
10974 return;
10975 }
10976
10977 /* First clear any old pattern. */
10978 if (!eap->skip)
10979 match_delete(curwin, id, FALSE);
10980
10981 if (ends_excmd(*eap->arg))
10982 end = eap->arg;
10983 else if ((STRNICMP(eap->arg, "none", 4) == 0
10984 && (VIM_ISWHITE(eap->arg[4]) || ends_excmd(eap->arg[4]))))
10985 end = eap->arg + 4;
10986 else
10987 {
10988 p = skiptowhite(eap->arg);
10989 if (!eap->skip)
10990 g = vim_strnsave(eap->arg, (int)(p - eap->arg));
10991 p = skipwhite(p);
10992 if (*p == NUL)
10993 {
10994 /* There must be two arguments. */
10995 vim_free(g);
10996 semsg(_(e_invarg2), eap->arg);
10997 return;
10998 }
10999 end = skip_regexp(p + 1, *p, TRUE, NULL);
11000 if (!eap->skip)
11001 {
11002 if (*end != NUL && !ends_excmd(*skipwhite(end + 1)))
11003 {
11004 vim_free(g);
11005 eap->errmsg = e_trailing;
11006 return;
11007 }
11008 if (*end != *p)
11009 {
11010 vim_free(g);
11011 semsg(_(e_invarg2), p);
11012 return;
11013 }
11014
11015 c = *end;
11016 *end = NUL;
11017 match_add(curwin, g, p + 1, 10, id, NULL, NULL);
11018 vim_free(g);
11019 *end = c;
11020 }
11021 }
11022 eap->nextcmd = find_nextcmd(end);
11023 }
11024 #endif 10953 #endif
11025 10954
11026 #ifdef FEAT_CRYPT 10955 #ifdef FEAT_CRYPT
11027 /* 10956 /*
11028 * ":X": Get crypt key 10957 * ":X": Get crypt key