Mercurial > vim
comparison src/match.c @ 28399:d395fadbaf67 v8.2.4724
patch 8.2.4724: current instance of last search pattern not easily spotted
Commit: https://github.com/vim/vim/commit/a43993897aa372159f682df37562f159994dc85c
Author: LemonBoy <thatlemon@gmail.com>
Date: Sat Apr 9 21:04:08 2022 +0100
patch 8.2.4724: current instance of last search pattern not easily spotted
Problem: Current instance of last search pattern not easily spotted.
Solution: Add CurSearch highlighting. (closes https://github.com/vim/vim/issues/10133)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 09 Apr 2022 22:15:03 +0200 |
parents | 62cc3b60493b |
children | 9ff0e5a29037 |
comparison
equal
deleted
inserted
replaced
28398:8b474e8eff92 | 28399:d395fadbaf67 |
---|---|
650 } | 650 } |
651 else | 651 else |
652 shl = &cur->hl; | 652 shl = &cur->hl; |
653 shl->startcol = MAXCOL; | 653 shl->startcol = MAXCOL; |
654 shl->endcol = MAXCOL; | 654 shl->endcol = MAXCOL; |
655 shl->lines = 0; | |
655 shl->attr_cur = 0; | 656 shl->attr_cur = 0; |
656 shl->is_addpos = FALSE; | 657 shl->is_addpos = FALSE; |
657 if (cur != NULL) | 658 if (cur != NULL) |
658 cur->pos.cur = 0; | 659 cur->pos.cur = 0; |
659 next_search_hl(wp, search_hl, shl, lnum, mincol, | 660 next_search_hl(wp, search_hl, shl, lnum, mincol, |
672 if (lnum == shl->lnum + shl->rm.endpos[0].lnum | 673 if (lnum == shl->lnum + shl->rm.endpos[0].lnum |
673 - shl->rm.startpos[0].lnum) | 674 - shl->rm.startpos[0].lnum) |
674 shl->endcol = shl->rm.endpos[0].col; | 675 shl->endcol = shl->rm.endpos[0].col; |
675 else | 676 else |
676 shl->endcol = MAXCOL; | 677 shl->endcol = MAXCOL; |
678 if (shl->rm.endpos[0].lnum != shl->rm.startpos[0].lnum) | |
679 shl->lines = shl->rm.endpos[0].lnum - shl->rm.startpos[0].lnum; | |
680 else | |
681 shl->lines = 1; | |
677 // Highlight one character for an empty match. | 682 // Highlight one character for an empty match. |
678 if (shl->startcol == shl->endcol) | 683 if (shl->startcol == shl->endcol) |
679 { | 684 { |
680 if (has_mbyte && (*line)[shl->endcol] != NUL) | 685 if (has_mbyte && (*line)[shl->endcol] != NUL) |
681 shl->endcol += (*mb_ptr2len)((*line) + shl->endcol); | 686 shl->endcol += (*mb_ptr2len)((*line) + shl->endcol); |
766 *match_conc = cur->conceal_char; | 771 *match_conc = cur->conceal_char; |
767 } | 772 } |
768 else | 773 else |
769 *has_match_conc = 0; | 774 *has_match_conc = 0; |
770 # endif | 775 # endif |
776 // Highlight the match were the cursor is using the CurSearch | |
777 // group. | |
778 if (shl == search_hl | |
779 && wp->w_cursor.lnum >= shl->lnum | |
780 && wp->w_cursor.lnum < shl->lnum + shl->lines | |
781 && wp->w_cursor.col >= shl->startcol | |
782 && wp->w_cursor.col < shl->endcol) | |
783 { | |
784 shl->attr_cur = HL_ATTR(HLF_LC); | |
785 } | |
786 | |
771 } | 787 } |
772 else if (col == shl->endcol) | 788 else if (col == shl->endcol) |
773 { | 789 { |
774 shl->attr_cur = 0; | 790 shl->attr_cur = 0; |
775 next_search_hl(wp, search_hl, shl, lnum, col, | 791 next_search_hl(wp, search_hl, shl, lnum, col, |