aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/match.c
diff options
context:
space:
mode:
authorbfredl <bjorn.linse@gmail.com>2022-04-19 18:56:51 +0200
committerGitHub <noreply@github.com>2022-04-19 18:56:51 +0200
commitdbc4af71861bf2d3bac6974a0bdb99b18a13666a (patch)
treee9baf3d0c05e38dacc5543c5187b1f6e88562790 /src/nvim/match.c
parent0124a7bfa9e27796e561cb0b3a045b9327bf7077 (diff)
parentb16afe4d556af7c3e86b311cfffd1c68a5eed71f (diff)
downloadrneovim-dbc4af71861bf2d3bac6974a0bdb99b18a13666a.tar.gz
rneovim-dbc4af71861bf2d3bac6974a0bdb99b18a13666a.tar.bz2
rneovim-dbc4af71861bf2d3bac6974a0bdb99b18a13666a.zip
Merge pull request #18081 from famiu/feat/highlight/cursearch
feat(highlight): implement CurSearch highlight
Diffstat (limited to 'src/nvim/match.c')
-rw-r--r--src/nvim/match.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/nvim/match.c b/src/nvim/match.c
index af89319a09..4129e84fc2 100644
--- a/src/nvim/match.c
+++ b/src/nvim/match.c
@@ -4,6 +4,7 @@
// match.c: functions for highlighting matches
#include <stdbool.h>
+#include "nvim/buffer_defs.h"
#include "nvim/charset.h"
#include "nvim/fold.h"
#include "nvim/highlight_group.h"
@@ -667,7 +668,16 @@ int update_search_hl(win_T *wp, linenr_T lnum, colnr_T col, char_u **line, match
if (shl->endcol < next_col) {
shl->endcol = next_col;
}
- shl->attr_cur = shl->attr;
+ // Use "CurSearch" highlight for current search match
+ if (shl == search_hl
+ && (HL_ATTR(HLF_LC) || wp->w_hl_ids[HLF_LC])
+ && wp->w_cursor.lnum == lnum
+ && wp->w_cursor.col >= shl->startcol
+ && wp->w_cursor.col < shl->endcol) {
+ shl->attr_cur = win_hl_attr(wp, HLF_LC) ? win_hl_attr(wp, HLF_LC) : HL_ATTR(HLF_LC);
+ } else {
+ shl->attr_cur = shl->attr;
+ }
// Match with the "Conceal" group results in hiding
// the match.
if (cur != NULL