Mercurial > vim
comparison src/ex_getln.c @ 12664:42cd1f315e8b v8.0.1210
patch 8.0.1210: CTRL-G and CTRL-T are ignored with typeahead
commit https://github.com/vim/vim/commit/f8e8c0643b1cd97db11912bc4f773e1328a0da02
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Oct 22 14:44:17 2017 +0200
patch 8.0.1210: CTRL-G and CTRL-T are ignored with typeahead
Problem: When typing a search pattern CTRL-G and CTRL-T are ignored when
there is typeahead.
Solution: Don't pass SEARCH_PEEK and don't call char_avail(). (haya14busa,
closes #2233)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 22 Oct 2017 14:45:05 +0200 |
parents | 0a9dacb8826a |
children | e769c912fcd9 |
comparison
equal
deleted
inserted
replaced
12663:f6e4a66dc55f | 12664:42cd1f315e8b |
---|---|
155 typestr[0] = typechar; | 155 typestr[0] = typechar; |
156 typestr[1] = NUL; | 156 typestr[1] = NUL; |
157 apply_autocmds(evt, typestr, typestr, FALSE, curbuf); | 157 apply_autocmds(evt, typestr, typestr, FALSE, curbuf); |
158 } | 158 } |
159 #endif | 159 #endif |
160 | |
161 /* | |
162 * Abandon the command line. | |
163 */ | |
164 static void | |
165 abandon_cmdline(void) | |
166 { | |
167 vim_free(ccline.cmdbuff); | |
168 ccline.cmdbuff = NULL; | |
169 if (msg_scrolled == 0) | |
170 compute_cmdrow(); | |
171 MSG(""); | |
172 redraw_cmdline = TRUE; | |
173 } | |
160 | 174 |
161 /* | 175 /* |
162 * getcmdline() - accept a command line starting with firstc. | 176 * getcmdline() - accept a command line starting with firstc. |
163 * | 177 * |
164 * firstc == ':' get ":" command line. | 178 * firstc == ':' get ":" command line. |
1700 case Ctrl_G: /* next match */ | 1714 case Ctrl_G: /* next match */ |
1701 case Ctrl_T: /* previous match */ | 1715 case Ctrl_T: /* previous match */ |
1702 if (p_is && !cmd_silent && (firstc == '/' || firstc == '?')) | 1716 if (p_is && !cmd_silent && (firstc == '/' || firstc == '?')) |
1703 { | 1717 { |
1704 pos_T t; | 1718 pos_T t; |
1705 int search_flags = SEARCH_KEEP + SEARCH_NOOF | 1719 int search_flags = SEARCH_KEEP + SEARCH_NOOF; |
1706 + SEARCH_PEEK; | 1720 |
1707 | |
1708 if (char_avail()) | |
1709 continue; | |
1710 cursor_off(); | 1721 cursor_off(); |
1711 out_flush(); | 1722 out_flush(); |
1712 if (c == Ctrl_G) | 1723 if (c == Ctrl_G) |
1713 { | 1724 { |
1714 t = match_end; | 1725 t = match_end; |
2081 new_last_cmdline = vim_strsave(ccline.cmdbuff); | 2092 new_last_cmdline = vim_strsave(ccline.cmdbuff); |
2082 } | 2093 } |
2083 } | 2094 } |
2084 #endif | 2095 #endif |
2085 | 2096 |
2086 if (gotesc) /* abandon command line */ | 2097 if (gotesc) |
2087 { | 2098 abandon_cmdline(); |
2088 vim_free(ccline.cmdbuff); | |
2089 ccline.cmdbuff = NULL; | |
2090 if (msg_scrolled == 0) | |
2091 compute_cmdrow(); | |
2092 MSG(""); | |
2093 redraw_cmdline = TRUE; | |
2094 } | |
2095 } | 2099 } |
2096 | 2100 |
2097 /* | 2101 /* |
2098 * If the screen was shifted up, redraw the whole screen (later). | 2102 * If the screen was shifted up, redraw the whole screen (later). |
2099 * If the line is too long, clear it, so ruler and shown command do | 2103 * If the line is too long, clear it, so ruler and shown command do |