diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2019-06-11 23:16:16 -0400 |
---|---|---|
committer | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2019-06-12 00:22:16 -0400 |
commit | 22d58ab66459c4c38f7117902b9498f81b4edfe5 (patch) | |
tree | dd781338bd334c3deae9c68fecaadb7773eb77ae /src/nvim/quickfix.c | |
parent | 005316ae41a03e75fac37a4892e2b8efde2f8b57 (diff) | |
download | rneovim-22d58ab66459c4c38f7117902b9498f81b4edfe5.tar.gz rneovim-22d58ab66459c4c38f7117902b9498f81b4edfe5.tar.bz2 rneovim-22d58ab66459c4c38f7117902b9498f81b4edfe5.zip |
vim-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)
https://github.com/vim/vim/commit/0a08c63da17dfd93ac2885e3f3f8a083a9b3131c
Diffstat (limited to 'src/nvim/quickfix.c')
-rw-r--r-- | src/nvim/quickfix.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c index ced0cf0f80..3c945a505b 100644 --- a/src/nvim/quickfix.c +++ b/src/nvim/quickfix.c @@ -2845,6 +2845,39 @@ static char_u *qf_types(int c, int nr) return buf; } +// 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(bool 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 cmd[32]; + + snprintf(cmd, sizeof(cmd), "split +%" PRId64 "%s", + (int64_t)curwin->w_cursor.lnum, + IS_LL_WINDOW(curwin) ? "ll" : "cc"); + if (do_cmdline_cmd(cmd) == OK) { + do_cmdline_cmd("clearjumps"); + } + return; + } + + do_cmdline_cmd((IS_LL_WINDOW(curwin) ? ".ll" : ".cc")); +} + /* * ":cwindow": open the quickfix window if we have errors to display, * close it if not. |