diff options
| author | Justin M. Keyes <justinkz@gmail.com> | 2018-09-10 09:24:16 +0200 |
|---|---|---|
| committer | Justin M. Keyes <justinkz@gmail.com> | 2018-09-10 09:24:16 +0200 |
| commit | d9fcd43638bf8721e98829db7adedf7ab60a9262 (patch) | |
| tree | d336dda1ecd2d3b93b4c27d830100b81a8d6f80a /src/nvim/quickfix.c | |
| parent | bbbed9fc6613c5b69d4ed471ff60d31246c03e35 (diff) | |
| parent | 0c80fead86cac10f97296b2ef14d52f0399cc845 (diff) | |
| download | rneovim-d9fcd43638bf8721e98829db7adedf7ab60a9262.tar.gz rneovim-d9fcd43638bf8721e98829db7adedf7ab60a9262.tar.bz2 rneovim-d9fcd43638bf8721e98829db7adedf7ab60a9262.zip | |
Merge #8967 'vim-patch:8.0.1781'
Diffstat (limited to 'src/nvim/quickfix.c')
| -rw-r--r-- | src/nvim/quickfix.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c index ba2f2ba969..7c555da1a0 100644 --- a/src/nvim/quickfix.c +++ b/src/nvim/quickfix.c @@ -2240,8 +2240,12 @@ void qf_list(exarg_T *eap) } } - if (qi->qf_lists[qi->qf_curlist].qf_nonevalid) - all = TRUE; + // Shorten all the file names, so that it is easy to read. + shorten_fnames(false); + + if (qi->qf_lists[qi->qf_curlist].qf_nonevalid) { + all = true; + } qfp = qi->qf_lists[qi->qf_curlist].qf_start; for (i = 1; !got_int && i <= qi->qf_lists[qi->qf_curlist].qf_count; ) { if ((qfp->qf_valid || all) && idx1 <= i && i <= idx2) { @@ -2944,6 +2948,10 @@ static void qf_fill_buffer(qf_info_T *qi, buf_T *buf, qfline_T *old_last) /* Check if there is anything to display */ if (qi->qf_curlist < qi->qf_listcount) { + char_u dirname[MAXPATHL]; + + *dirname = NUL; + // Add one line for each error if (old_last == NULL) { qfp = qi->qf_lists[qi->qf_curlist].qf_start; @@ -2959,6 +2967,14 @@ static void qf_fill_buffer(qf_info_T *qi, buf_T *buf, qfline_T *old_last) if (qfp->qf_type == 1) { // :helpgrep STRLCPY(IObuff, path_tail(errbuf->b_fname), sizeof(IObuff)); } else { + // shorten the file name if not done already + if (errbuf->b_sfname == NULL + || path_is_absolute(errbuf->b_sfname)) { + if (*dirname == NUL) { + os_dirname(dirname, MAXPATHL); + } + shorten_buf_fname(errbuf, dirname, false); + } STRLCPY(IObuff, errbuf->b_fname, sizeof(IObuff)); } len = (int)STRLEN(IObuff); |
