diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-12-17 12:40:30 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2024-12-18 08:15:31 +0800 |
commit | c830901e8cde49467d1c99c2d656a13e51979790 (patch) | |
tree | 26e8ec89d933f4697f7ee5bd9e3feaae4d442f8c /src/nvim/drawline.c | |
parent | 0dd933265ff2e64786fd30f949e767e10f401519 (diff) | |
download | rneovim-c830901e8cde49467d1c99c2d656a13e51979790.tar.gz rneovim-c830901e8cde49467d1c99c2d656a13e51979790.tar.bz2 rneovim-c830901e8cde49467d1c99c2d656a13e51979790.zip |
vim-patch:9.1.0936: cannot highlight completed text
Problem: cannot highlight completed text
Solution: (optionally) highlight auto-completed text using the
ComplMatchIns highlight group (glepnir)
closes: vim/vim#16173
https://github.com/vim/vim/commit/6a38aff218f5b99a1aed7edaa357df24b9092734
Co-authored-by: glepnir <glephunter@gmail.com>
Diffstat (limited to 'src/nvim/drawline.c')
-rw-r--r-- | src/nvim/drawline.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/nvim/drawline.c b/src/nvim/drawline.c index b8f21d7454..e15296572b 100644 --- a/src/nvim/drawline.c +++ b/src/nvim/drawline.c @@ -31,6 +31,7 @@ #include "nvim/highlight_defs.h" #include "nvim/highlight_group.h" #include "nvim/indent.h" +#include "nvim/insexpand.h" #include "nvim/mark_defs.h" #include "nvim/marktree_defs.h" #include "nvim/match.h" @@ -934,6 +935,7 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, int col_rows, s colnr_T vcol_prev = -1; // "wlv.vcol" of previous character ScreenGrid *grid = &wp->w_grid; // grid specific to the window + const bool in_curline = wp == curwin && lnum == curwin->w_cursor.lnum; const bool has_fold = foldinfo.fi_level != 0 && foldinfo.fi_lines > 0; const bool has_foldtext = has_fold && *wp->w_p_fdt != NUL; @@ -954,6 +956,7 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, int col_rows, s int vi_attr = 0; // attributes for Visual and incsearch highlighting int area_attr = 0; // attributes desired by highlighting int search_attr = 0; // attributes desired by 'hlsearch' + int ins_match_attr = 0; // attributes desired by PmenuMatch int vcol_save_attr = 0; // saved attr for 'cursorcolumn' int decor_attr = 0; // attributes desired by syntax and extmarks bool has_syntax = false; // this buffer has syntax highl. @@ -1117,7 +1120,7 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, int col_rows, s } // Check if the char under the cursor should be inverted (highlighted). - if (!highlight_match && lnum == curwin->w_cursor.lnum && wp == curwin + if (!highlight_match && in_curline && cursor_is_block_during_visual(*p_sel == 'e')) { noinvcur = true; } @@ -2704,6 +2707,14 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, int col_rows, s vcol_prev = wlv.vcol; } + if (wlv.filler_todo <= 0 + && (State & MODE_INSERT) && in_curline && ins_compl_active()) { + ins_match_attr = ins_compl_col_range_attr(wlv.col); + if (ins_match_attr > 0) { + wlv.char_attr = hl_combine_attr(wlv.char_attr, ins_match_attr); + } + } + // Store character to be displayed. // Skip characters that are left of the screen for 'nowrap'. if (wlv.filler_todo > 0) { |