comparison src/quickfix.c @ 12912:888441e8fbb0 v8.0.1332

patch 8.0.1332: highlighting in quickfix window could be better commit https://github.com/vim/vim/commit/93a32e2ec4b5a391c5006ca09f196e6510c8c2e9 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Nov 23 22:05:45 2017 +0100 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)
author Christian Brabandt <cb@256bit.org>
date Thu, 23 Nov 2017 22:15:05 +0100
parents c7164578e508
children 49e136457c66
comparison
equal deleted inserted replaced
12911:e865f9c6bb9e 12912:888441e8fbb0
2652 int i; 2652 int i;
2653 int idx1 = 1; 2653 int idx1 = 1;
2654 int idx2 = -1; 2654 int idx2 = -1;
2655 char_u *arg = eap->arg; 2655 char_u *arg = eap->arg;
2656 int plus = FALSE; 2656 int plus = FALSE;
2657 int qfFileAttr;
2658 int qfSepAttr;
2659 int qfLineAttr;
2657 int all = eap->forceit; /* if not :cl!, only show 2660 int all = eap->forceit; /* if not :cl!, only show
2658 recognised errors */ 2661 recognised errors */
2659 qf_info_T *qi = &ql_info; 2662 qf_info_T *qi = &ql_info;
2660 2663
2661 if (eap->cmdidx == CMD_llist) 2664 if (eap->cmdidx == CMD_llist)
2696 if (idx1 < 0) 2699 if (idx1 < 0)
2697 idx1 = (-idx1 > i) ? 0 : idx1 + i + 1; 2700 idx1 = (-idx1 > i) ? 0 : idx1 + i + 1;
2698 if (idx2 < 0) 2701 if (idx2 < 0)
2699 idx2 = (-idx2 > i) ? 0 : idx2 + i + 1; 2702 idx2 = (-idx2 > i) ? 0 : idx2 + i + 1;
2700 } 2703 }
2704
2705 /*
2706 * Get the attributes for the different quickfix highlight items. Note
2707 * that this depends on syntax items defined in the qf.vim syntax file
2708 */
2709 qfFileAttr = syn_name2attr((char_u *)"qfFileName");
2710 if (qfFileAttr == 0)
2711 qfFileAttr = HL_ATTR(HLF_D);
2712 qfSepAttr = syn_name2attr((char_u *)"qfSeparator");
2713 if (qfSepAttr == 0)
2714 qfSepAttr = HL_ATTR(HLF_D);
2715 qfLineAttr = syn_name2attr((char_u *)"qfLineNr");
2716 if (qfLineAttr == 0)
2717 qfLineAttr = HL_ATTR(HLF_N);
2701 2718
2702 if (qi->qf_lists[qi->qf_curlist].qf_nonevalid) 2719 if (qi->qf_lists[qi->qf_curlist].qf_nonevalid)
2703 all = TRUE; 2720 all = TRUE;
2704 qfp = qi->qf_lists[qi->qf_curlist].qf_start; 2721 qfp = qi->qf_lists[qi->qf_curlist].qf_start;
2705 for (i = 1; !got_int && i <= qi->qf_lists[qi->qf_curlist].qf_count; ) 2722 for (i = 1; !got_int && i <= qi->qf_lists[qi->qf_curlist].qf_count; )
2722 sprintf((char *)IObuff, "%2d", i); 2739 sprintf((char *)IObuff, "%2d", i);
2723 else 2740 else
2724 vim_snprintf((char *)IObuff, IOSIZE, "%2d %s", 2741 vim_snprintf((char *)IObuff, IOSIZE, "%2d %s",
2725 i, (char *)fname); 2742 i, (char *)fname);
2726 msg_outtrans_attr(IObuff, i == qi->qf_lists[qi->qf_curlist].qf_index 2743 msg_outtrans_attr(IObuff, i == qi->qf_lists[qi->qf_curlist].qf_index
2727 ? HL_ATTR(HLF_QFL) : HL_ATTR(HLF_D)); 2744 ? HL_ATTR(HLF_QFL) : qfFileAttr);
2745
2746 if (qfp->qf_lnum != 0)
2747 msg_puts_attr((char_u *)":", qfSepAttr);
2728 if (qfp->qf_lnum == 0) 2748 if (qfp->qf_lnum == 0)
2729 IObuff[0] = NUL; 2749 IObuff[0] = NUL;
2730 else if (qfp->qf_col == 0) 2750 else if (qfp->qf_col == 0)
2731 sprintf((char *)IObuff, ":%ld", qfp->qf_lnum); 2751 sprintf((char *)IObuff, "%ld", qfp->qf_lnum);
2732 else 2752 else
2733 sprintf((char *)IObuff, ":%ld col %d", 2753 sprintf((char *)IObuff, "%ld col %d",
2734 qfp->qf_lnum, qfp->qf_col); 2754 qfp->qf_lnum, qfp->qf_col);
2735 sprintf((char *)IObuff + STRLEN(IObuff), "%s:", 2755 sprintf((char *)IObuff + STRLEN(IObuff), "%s",
2736 (char *)qf_types(qfp->qf_type, qfp->qf_nr)); 2756 (char *)qf_types(qfp->qf_type, qfp->qf_nr));
2737 msg_puts_attr(IObuff, HL_ATTR(HLF_N)); 2757 msg_puts_attr(IObuff, qfLineAttr);
2758 msg_puts_attr((char_u *)":", qfSepAttr);
2738 if (qfp->qf_pattern != NULL) 2759 if (qfp->qf_pattern != NULL)
2739 { 2760 {
2740 qf_fmt_text(qfp->qf_pattern, IObuff, IOSIZE); 2761 qf_fmt_text(qfp->qf_pattern, IObuff, IOSIZE);
2741 STRCAT(IObuff, ":");
2742 msg_puts(IObuff); 2762 msg_puts(IObuff);
2763 msg_puts_attr((char_u *)":", qfSepAttr);
2743 } 2764 }
2744 msg_puts((char_u *)" "); 2765 msg_puts((char_u *)" ");
2745 2766
2746 /* Remove newlines and leading whitespace from the text. For an 2767 /* Remove newlines and leading whitespace from the text. For an
2747 * unrecognized line keep the indent, the compiler may mark a word 2768 * unrecognized line keep the indent, the compiler may mark a word