diff options
author | Bram Moolenaar <Bram@vim.org> | 2018-05-01 14:30:36 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2018-05-01 14:30:36 +0200 |
commit | a796d46f29e3cc235cc981696d7ee80faccb5000 (patch) | |
tree | 542906c6f700a59c60ad6dcd203be8d75dd66643 /src/quickfix.c | |
parent | 15142e27aaafa15b72d1042c25fbb5e4f12b6736 (diff) | |
download | vim-git-a796d46f29e3cc235cc981696d7ee80faccb5000.tar.gz |
patch 8.0.1781: file names in quickfix window are not shortenedv8.0.1781
Problem: File names in quickfix window are not always shortened.
Solution: Shorten the file name when opening the quickfix window. (Yegappan
Lakshmanan, closes #2851, closes #2846)
Diffstat (limited to 'src/quickfix.c')
-rw-r--r-- | src/quickfix.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/quickfix.c b/src/quickfix.c index acff1ec70..dde68419a 100644 --- a/src/quickfix.c +++ b/src/quickfix.c @@ -2736,6 +2736,9 @@ qf_list(exarg_T *eap) idx2 = (-idx2 > i) ? 0 : idx2 + i + 1; } + /* Shorten all the file names, so that it is easy to read */ + shorten_fnames(FALSE); + /* * Get the attributes for the different quickfix highlight items. Note * that this depends on syntax items defined in the qf.vim syntax file @@ -3542,6 +3545,10 @@ 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) { @@ -3562,7 +3569,17 @@ qf_fill_buffer(qf_info_T *qi, buf_T *buf, qfline_T *old_last) if (qfp->qf_type == 1) /* :helpgrep */ STRCPY(IObuff, gettail(errbuf->b_fname)); else + { + /* shorten the file name if not done already */ + if (errbuf->b_sfname == NULL + || mch_isFullName(errbuf->b_sfname)) + { + if (*dirname == NUL) + mch_dirname(dirname, MAXPATHL); + shorten_buf_fname(errbuf, dirname, FALSE); + } STRCPY(IObuff, errbuf->b_fname); + } len = (int)STRLEN(IObuff); } else |