@@ -1503,82 +1503,14 @@ getcmdline(
15031503
15041504 case Ctrl_N : /* next match */
15051505 case Ctrl_P : /* previous match */
1506- #ifdef FEAT_SEARCH_EXTRA
1507- if (p_is && !cmd_silent && (firstc == '/' || firstc == '?' ))
1508- {
1509- pos_T t ;
1510- int search_flags = SEARCH_KEEP + SEARCH_NOOF
1511- + SEARCH_PEEK ;
1512-
1513- if (char_avail ())
1514- continue ;
1515- cursor_off ();
1516- out_flush ();
1517- if (c == Ctrl_N )
1518- {
1519- t = match_end ;
1520- search_flags += SEARCH_COL ;
1521- }
1522- else
1523- t = match_start ;
1524- ++ emsg_off ;
1525- i = searchit (curwin , curbuf , & t ,
1526- c == Ctrl_N ? FORWARD : BACKWARD ,
1527- ccline .cmdbuff , count , search_flags ,
1528- RE_SEARCH , 0 , NULL );
1529- -- emsg_off ;
1530- if (i )
1531- {
1532- old_cursor = match_start ;
1533- match_end = t ;
1534- match_start = t ;
1535- if (c == Ctrl_P && firstc == '/' )
1536- {
1537- /* move just before the current match, so that
1538- * when nv_search finishes the cursor will be
1539- * put back on the match */
1540- old_cursor = t ;
1541- (void )decl (& old_cursor );
1542- }
1543- if (lt (t , old_cursor ) && c == Ctrl_N )
1544- {
1545- /* wrap around */
1546- old_cursor = t ;
1547- if (firstc == '?' )
1548- (void )incl (& old_cursor );
1549- else
1550- (void )decl (& old_cursor );
1551- }
1552-
1553- set_search_match (& match_end );
1554- curwin -> w_cursor = match_start ;
1555- changed_cline_bef_curs ();
1556- update_topline ();
1557- validate_cursor ();
1558- highlight_match = TRUE;
1559- old_curswant = curwin -> w_curswant ;
1560- old_leftcol = curwin -> w_leftcol ;
1561- old_topline = curwin -> w_topline ;
1562- # ifdef FEAT_DIFF
1563- old_topfill = curwin -> w_topfill ;
1564- # endif
1565- old_botline = curwin -> w_botline ;
1566- update_screen (NOT_VALID );
1567- redrawcmdline ();
1568- }
1569- else
1570- vim_beep (BO_ERROR );
1571- goto cmdline_not_changed ;
1572- }
1573- else
1574- #endif
15751506 if (xpc .xp_numfiles > 0 )
15761507 {
15771508 if (nextwild (& xpc , (c == Ctrl_P ) ? WILD_PREV : WILD_NEXT ,
15781509 0 , firstc != '@' ) == FAIL )
15791510 break ;
1580- goto cmdline_changed ;
1511+ goto cmdline_not_changed ;
15811512 }
1513+ /* FALLTHROUGH */
15821514
15831515#ifdef FEAT_CMDHIST
15841516 case K_UP :
@@ -1722,6 +1654,77 @@ getcmdline(
17221654 goto cmdline_changed ;
17231655 }
17241656 beep_flush ();
1657+ #endif
1658+ goto cmdline_not_changed ;
1659+
1660+ case Ctrl_G : /* next match */
1661+ case Ctrl_T : /* previous match */
1662+ #ifdef FEAT_SEARCH_EXTRA
1663+ if (p_is && !cmd_silent && (firstc == '/' || firstc == '?' ))
1664+ {
1665+ pos_T t ;
1666+ int search_flags = SEARCH_KEEP + SEARCH_NOOF
1667+ + SEARCH_PEEK ;
1668+
1669+ if (char_avail ())
1670+ continue ;
1671+ cursor_off ();
1672+ out_flush ();
1673+ if (c == Ctrl_G )
1674+ {
1675+ t = match_end ;
1676+ search_flags += SEARCH_COL ;
1677+ }
1678+ else
1679+ t = match_start ;
1680+ ++ emsg_off ;
1681+ i = searchit (curwin , curbuf , & t ,
1682+ c == Ctrl_G ? FORWARD : BACKWARD ,
1683+ ccline .cmdbuff , count , search_flags ,
1684+ RE_SEARCH , 0 , NULL );
1685+ -- emsg_off ;
1686+ if (i )
1687+ {
1688+ old_cursor = match_start ;
1689+ match_end = t ;
1690+ match_start = t ;
1691+ if (c == Ctrl_T && firstc == '/' )
1692+ {
1693+ /* move just before the current match, so that
1694+ * when nv_search finishes the cursor will be
1695+ * put back on the match */
1696+ old_cursor = t ;
1697+ (void )decl (& old_cursor );
1698+ }
1699+ if (lt (t , old_cursor ) && c == Ctrl_G )
1700+ {
1701+ /* wrap around */
1702+ old_cursor = t ;
1703+ if (firstc == '?' )
1704+ (void )incl (& old_cursor );
1705+ else
1706+ (void )decl (& old_cursor );
1707+ }
1708+
1709+ set_search_match (& match_end );
1710+ curwin -> w_cursor = match_start ;
1711+ changed_cline_bef_curs ();
1712+ update_topline ();
1713+ validate_cursor ();
1714+ highlight_match = TRUE;
1715+ old_curswant = curwin -> w_curswant ;
1716+ old_leftcol = curwin -> w_leftcol ;
1717+ old_topline = curwin -> w_topline ;
1718+ # ifdef FEAT_DIFF
1719+ old_topfill = curwin -> w_topfill ;
1720+ # endif
1721+ old_botline = curwin -> w_botline ;
1722+ update_screen (NOT_VALID );
1723+ redrawcmdline ();
1724+ }
1725+ else
1726+ vim_beep (BO_ERROR );
1727+ }
17251728 goto cmdline_not_changed ;
17261729#endif
17271730
0 commit comments