diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-12-18 07:34:52 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2024-12-18 08:15:31 +0800 |
commit | 2f7b385f2ef61626bc034bd6f3a25f5ec9f3a1f3 (patch) | |
tree | 22fa7d5d9c4621fb3cf9a313bf348a1135fd4c83 /src/nvim/drawline.c | |
parent | c830901e8cde49467d1c99c2d656a13e51979790 (diff) | |
download | rneovim-2f7b385f2ef61626bc034bd6f3a25f5ec9f3a1f3.tar.gz rneovim-2f7b385f2ef61626bc034bd6f3a25f5ec9f3a1f3.tar.bz2 rneovim-2f7b385f2ef61626bc034bd6f3a25f5ec9f3a1f3.zip |
vim-patch:9.1.0941: ComplMatchIns doesn't work after multibyte chars
Problem: ComplMatchIns doesn't work after multibyte chars
(after v9.1.0936)
Solution: Use (ptr - line) instead of wlv.col (zeertzjq).
closes: vim/vim#16233
https://github.com/vim/vim/commit/f4ccada5c372b2c14cc32490860c6995cd00268c
Diffstat (limited to 'src/nvim/drawline.c')
-rw-r--r-- | src/nvim/drawline.c | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/src/nvim/drawline.c b/src/nvim/drawline.c index e15296572b..a1d03486ff 100644 --- a/src/nvim/drawline.c +++ b/src/nvim/drawline.c @@ -956,7 +956,6 @@ 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. @@ -1632,8 +1631,7 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, int col_rows, s } // When still displaying '$' of change command, stop at cursor. - if (dollar_vcol >= 0 && wp == curwin - && lnum == wp->w_cursor.lnum && wlv.vcol >= wp->w_virtcol) { + if (dollar_vcol >= 0 && in_curline && wlv.vcol >= wp->w_virtcol) { draw_virt_text(wp, buf, win_col_offset, &wlv.col, wlv.row); // don't clear anything after wlv.col wlv_put_linebuf(wp, &wlv, wlv.col, false, bg_attr, 0); @@ -1789,6 +1787,16 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, int col_rows, s wlv.char_attr = hl_combine_attr(char_attr_base, char_attr_pri); } + // Apply ComplMatchIns highlight if needed. + if (wlv.filler_todo <= 0 + && (State & MODE_INSERT) && in_curline && ins_compl_active()) { + int ins_match_attr = ins_compl_col_range_attr((int)(ptr - line)); + if (ins_match_attr > 0) { + char_attr_pri = hl_combine_attr(char_attr_pri, ins_match_attr); + wlv.char_attr = hl_combine_attr(char_attr_base, char_attr_pri); + } + } + if (draw_folded && has_foldtext && wlv.n_extra == 0 && wlv.col == win_col_offset) { const int v = (int)(ptr - line); linenr_T lnume = lnum + foldinfo.fi_lines - 1; @@ -2449,8 +2457,7 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, int col_rows, s // With 'virtualedit' we may never reach cursor position, but we still // need to correct the cursor column, so do that at end of line. if (!did_wcol && wlv.filler_todo <= 0 - && wp == curwin && lnum == wp->w_cursor.lnum - && conceal_cursor_line(wp) + && in_curline && conceal_cursor_line(wp) && (wlv.vcol + wlv.skip_cells >= wp->w_virtcol || mb_schar == NUL)) { wp->w_wcol = wlv.col - wlv.boguscols; if (wlv.vcol + wlv.skip_cells < wp->w_virtcol) { @@ -2643,7 +2650,7 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, int col_rows, s // Update w_cline_height and w_cline_folded if the cursor line was // updated (saves a call to plines_win() later). - if (wp == curwin && lnum == curwin->w_cursor.lnum) { + if (in_curline) { curwin->w_cline_row = startrow; curwin->w_cline_height = wlv.row - startrow; curwin->w_cline_folded = has_fold; @@ -2707,14 +2714,6 @@ 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) { |