comparison 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
comparison
equal deleted inserted replaced
2924:199b94533764 2925:441d364773dc
1544 static int lastcdir; /* last direction of character search */ 1544 static int lastcdir; /* last direction of character search */
1545 static int last_t_cmd; /* last search t_cmd */ 1545 static int last_t_cmd; /* last search t_cmd */
1546 int col; 1546 int col;
1547 char_u *p; 1547 char_u *p;
1548 int len; 1548 int len;
1549 int stop = TRUE;
1549 #ifdef FEAT_MBYTE 1550 #ifdef FEAT_MBYTE
1550 static char_u bytes[MB_MAXBYTES]; 1551 static char_u bytes[MB_MAXBYTES];
1551 static int bytelen = 1; /* >1 for multi-byte char */ 1552 static int bytelen = 1; /* >1 for multi-byte char */
1552 #endif 1553 #endif
1553 1554
1578 else 1579 else
1579 dir = lastcdir; 1580 dir = lastcdir;
1580 t_cmd = last_t_cmd; 1581 t_cmd = last_t_cmd;
1581 c = lastc; 1582 c = lastc;
1582 /* For multi-byte re-use last bytes[] and bytelen. */ 1583 /* For multi-byte re-use last bytes[] and bytelen. */
1584
1585 /* Force a move of at least one char, so ";" and "," will move the
1586 * cursor, even if the cursor is right in front of char we are looking
1587 * at. */
1588 if (vim_strchr(p_cpo, CPO_SCOLON) == NULL && count == 1)
1589 stop = FALSE;
1583 } 1590 }
1584 1591
1585 if (dir == BACKWARD) 1592 if (dir == BACKWARD)
1586 cap->oap->inclusive = FALSE; 1593 cap->oap->inclusive = FALSE;
1587 else 1594 else
1610 return FAIL; 1617 return FAIL;
1611 col -= (*mb_head_off)(p, p + col - 1) + 1; 1618 col -= (*mb_head_off)(p, p + col - 1) + 1;
1612 } 1619 }
1613 if (bytelen == 1) 1620 if (bytelen == 1)
1614 { 1621 {
1615 if (p[col] == c) 1622 if (p[col] == c && stop)
1616 break; 1623 break;
1617 } 1624 }
1618 else 1625 else
1619 { 1626 {
1620 if (vim_memcmp(p + col, bytes, bytelen) == 0) 1627 if (vim_memcmp(p + col, bytes, bytelen) == 0 && stop)
1621 break; 1628 break;
1622 } 1629 }
1630 stop = TRUE;
1623 } 1631 }
1624 } 1632 }
1625 else 1633 else
1626 #endif 1634 #endif
1627 { 1635 {
1628 for (;;) 1636 for (;;)
1629 { 1637 {
1630 if ((col += dir) < 0 || col >= len) 1638 if ((col += dir) < 0 || col >= len)
1631 return FAIL; 1639 return FAIL;
1632 if (p[col] == c) 1640 if (p[col] == c && stop)
1633 break; 1641 break;
1642 stop = TRUE;
1634 } 1643 }
1635 } 1644 }
1636 } 1645 }
1637 1646
1638 if (t_cmd) 1647 if (t_cmd)