diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2019-06-12 08:21:31 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-12 08:21:31 +0200 |
commit | babcf641efcbe7e9007285ef9c639da8639e7144 (patch) | |
tree | dd781338bd334c3deae9c68fecaadb7773eb77ae /src/nvim/quickfix.c | |
parent | f8d0e41b2864da53a7763a71cf27bb643aca7a0f (diff) | |
parent | 22d58ab66459c4c38f7117902b9498f81b4edfe5 (diff) | |
download | rneovim-babcf641efcbe7e9007285ef9c639da8639e7144.tar.gz rneovim-babcf641efcbe7e9007285ef9c639da8639e7144.tar.bz2 rneovim-babcf641efcbe7e9007285ef9c639da8639e7144.zip |
Merge #10192 from janlazo/vim-8.0.1689
vim-patch:8.0.1689,8.1.0213
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. |