Mercurial > vim
diff src/search.c @ 2925:441d364773dc v7.3.235
updated for version 7.3.235
Problem: ";" gets stuck on a "t" command, it's not useful.
Solution: Add the ';' flag in 'cpo'. (Christian Brabandt)
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Sun, 26 Jun 2011 05:36:34 +0200 |
parents | 8bd38abda314 |
children | 3f1a4ed36d1b |
line wrap: on
line diff
--- a/src/search.c +++ b/src/search.c @@ -1546,6 +1546,7 @@ searchc(cap, t_cmd) int col; char_u *p; int len; + int stop = TRUE; #ifdef FEAT_MBYTE static char_u bytes[MB_MAXBYTES]; static int bytelen = 1; /* >1 for multi-byte char */ @@ -1580,6 +1581,12 @@ searchc(cap, t_cmd) t_cmd = last_t_cmd; c = lastc; /* For multi-byte re-use last bytes[] and bytelen. */ + + /* Force a move of at least one char, so ";" and "," will move the + * cursor, even if the cursor is right in front of char we are looking + * at. */ + if (vim_strchr(p_cpo, CPO_SCOLON) == NULL && count == 1) + stop = FALSE; } if (dir == BACKWARD) @@ -1612,14 +1619,15 @@ searchc(cap, t_cmd) } if (bytelen == 1) { - if (p[col] == c) + if (p[col] == c && stop) break; } else { - if (vim_memcmp(p + col, bytes, bytelen) == 0) + if (vim_memcmp(p + col, bytes, bytelen) == 0 && stop) break; } + stop = TRUE; } } else @@ -1629,8 +1637,9 @@ searchc(cap, t_cmd) { if ((col += dir) < 0 || col >= len) return FAIL; - if (p[col] == c) + if (p[col] == c && stop) break; + stop = TRUE; } } }