Mercurial > vim
diff src/quickfix.c @ 14397:19d99d9e670c v8.1.0213
patch 8.1.0213: CTRL-W CR does not work properly in a quickfix window
commit https://github.com/vim/vim/commit/0a08c63da17dfd93ac2885e3f3f8a083a9b3131c
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Jul 25 22:36:52 2018 +0200
patch 8.1.0213: CTRL-W CR does not work properly in a quickfix window
Problem: CTRL-W CR does not work properly in a quickfix window.
Solution: Split the window if needed. (Jason Franklin)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Wed, 25 Jul 2018 22:45:04 +0200 |
parents | df27d6270691 |
children | 4a94173743d9 |
line wrap: on
line diff
--- a/src/quickfix.c +++ b/src/quickfix.c @@ -3490,6 +3490,42 @@ qf_types(int c, int nr) } /* + * When "split" is FALSE: Open the entry/result under the cursor. + * When "split" is TRUE: Open the entry/result under the cursor in a new window. + */ + void +qf_view_result(int split) +{ + qf_info_T *qi = &ql_info; + + if (!bt_quickfix(curbuf)) + return; + + if (IS_LL_WINDOW(curwin)) + qi = GET_LOC_LIST(curwin); + + if (qi == NULL || qi->qf_lists[qi->qf_curlist].qf_count == 0) + { + EMSG(_(e_quickfix)); + return; + } + + if (split) + { + char_u cmd[32]; + + vim_snprintf((char *)cmd, sizeof(cmd), "split +%ld%s", + (long)curwin->w_cursor.lnum, + IS_LL_WINDOW(curwin) ? "ll" : "cc"); + if (do_cmdline_cmd(cmd) == OK) + do_cmdline_cmd((char_u *) "clearjumps"); + return; + } + + do_cmdline_cmd((char_u *)(IS_LL_WINDOW(curwin) ? ".ll" : ".cc")); +} + +/* * ":cwindow": open the quickfix window if we have errors to display, * close it if not. * ":lwindow": open the location list window if we have locations to display,