0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

patch 8.0.1332: highlighting in quickfix window could be better

Problem:    Highlighting in quickfix window could be better. (Axel Bender)
Solution:   Use the qfSeparator highlight item. (Yegappan Lakshmanan)
This commit is contained in:
Bram Moolenaar
2017-11-23 22:05:45 +01:00
parent 3679c17917
commit 93a32e2ec4
2 changed files with 29 additions and 6 deletions

View File

@@ -2654,6 +2654,9 @@ qf_list(exarg_T *eap)
int idx2 = -1; int idx2 = -1;
char_u *arg = eap->arg; char_u *arg = eap->arg;
int plus = FALSE; int plus = FALSE;
int qfFileAttr;
int qfSepAttr;
int qfLineAttr;
int all = eap->forceit; /* if not :cl!, only show int all = eap->forceit; /* if not :cl!, only show
recognised errors */ recognised errors */
qf_info_T *qi = &ql_info; qf_info_T *qi = &ql_info;
@@ -2699,6 +2702,20 @@ qf_list(exarg_T *eap)
idx2 = (-idx2 > i) ? 0 : idx2 + i + 1; idx2 = (-idx2 > i) ? 0 : idx2 + i + 1;
} }
/*
* Get the attributes for the different quickfix highlight items. Note
* that this depends on syntax items defined in the qf.vim syntax file
*/
qfFileAttr = syn_name2attr((char_u *)"qfFileName");
if (qfFileAttr == 0)
qfFileAttr = HL_ATTR(HLF_D);
qfSepAttr = syn_name2attr((char_u *)"qfSeparator");
if (qfSepAttr == 0)
qfSepAttr = HL_ATTR(HLF_D);
qfLineAttr = syn_name2attr((char_u *)"qfLineNr");
if (qfLineAttr == 0)
qfLineAttr = HL_ATTR(HLF_N);
if (qi->qf_lists[qi->qf_curlist].qf_nonevalid) if (qi->qf_lists[qi->qf_curlist].qf_nonevalid)
all = TRUE; all = TRUE;
qfp = qi->qf_lists[qi->qf_curlist].qf_start; qfp = qi->qf_lists[qi->qf_curlist].qf_start;
@@ -2724,22 +2741,26 @@ qf_list(exarg_T *eap)
vim_snprintf((char *)IObuff, IOSIZE, "%2d %s", vim_snprintf((char *)IObuff, IOSIZE, "%2d %s",
i, (char *)fname); i, (char *)fname);
msg_outtrans_attr(IObuff, i == qi->qf_lists[qi->qf_curlist].qf_index msg_outtrans_attr(IObuff, i == qi->qf_lists[qi->qf_curlist].qf_index
? HL_ATTR(HLF_QFL) : HL_ATTR(HLF_D)); ? HL_ATTR(HLF_QFL) : qfFileAttr);
if (qfp->qf_lnum != 0)
msg_puts_attr((char_u *)":", qfSepAttr);
if (qfp->qf_lnum == 0) if (qfp->qf_lnum == 0)
IObuff[0] = NUL; IObuff[0] = NUL;
else if (qfp->qf_col == 0) else if (qfp->qf_col == 0)
sprintf((char *)IObuff, ":%ld", qfp->qf_lnum); sprintf((char *)IObuff, "%ld", qfp->qf_lnum);
else else
sprintf((char *)IObuff, ":%ld col %d", sprintf((char *)IObuff, "%ld col %d",
qfp->qf_lnum, qfp->qf_col); qfp->qf_lnum, qfp->qf_col);
sprintf((char *)IObuff + STRLEN(IObuff), "%s:", sprintf((char *)IObuff + STRLEN(IObuff), "%s",
(char *)qf_types(qfp->qf_type, qfp->qf_nr)); (char *)qf_types(qfp->qf_type, qfp->qf_nr));
msg_puts_attr(IObuff, HL_ATTR(HLF_N)); msg_puts_attr(IObuff, qfLineAttr);
msg_puts_attr((char_u *)":", qfSepAttr);
if (qfp->qf_pattern != NULL) if (qfp->qf_pattern != NULL)
{ {
qf_fmt_text(qfp->qf_pattern, IObuff, IOSIZE); qf_fmt_text(qfp->qf_pattern, IObuff, IOSIZE);
STRCAT(IObuff, ":");
msg_puts(IObuff); msg_puts(IObuff);
msg_puts_attr((char_u *)":", qfSepAttr);
} }
msg_puts((char_u *)" "); msg_puts((char_u *)" ");

View File

@@ -771,6 +771,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1332,
/**/ /**/
1331, 1331,
/**/ /**/