diff options
Diffstat (limited to 'src/nvim/screen.c')
-rw-r--r-- | src/nvim/screen.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/src/nvim/screen.c b/src/nvim/screen.c index 9fdb476748..c4264cbcee 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -2934,14 +2934,16 @@ win_line ( } } - /* Decide which of the highlight attributes to use. */ - attr_pri = TRUE; - if (area_attr != 0) - char_attr = area_attr; - else if (search_attr != 0) - char_attr = search_attr; - /* Use line_attr when not in the Visual or 'incsearch' area - * (area_attr may be 0 when "noinvcur" is set). */ + // Decide which of the highlight attributes to use. + attr_pri = true; + + if (area_attr != 0) { + char_attr = hl_combine_attr(line_attr, area_attr); + } else if (search_attr != 0) { + char_attr = hl_combine_attr(line_attr, search_attr); + } + // Use line_attr when not in the Visual or 'incsearch' area + // (area_attr may be 0 when "noinvcur" is set). else if (line_attr != 0 && ((fromcol == -10 && tocol == MAXCOL) || vcol < fromcol || vcol_prev < fromcol_prev || vcol >= tocol)) @@ -3323,16 +3325,15 @@ win_line ( * Found last space before word: check for line break. */ if (wp->w_p_lbr && vim_isbreak(c) && !vim_isbreak(*ptr)) { - char_u *p = ptr - ( - has_mbyte ? mb_l : - 1); + int mb_off = has_mbyte ? (*mb_head_off)(line, ptr - 1) : 0; + char_u *p = ptr - (mb_off + 1); // TODO: is passing p for start of the line OK? n_extra = win_lbr_chartabsize(wp, line, p, (colnr_T)vcol, NULL) - 1; if (c == TAB && n_extra + col > wp->w_width) { n_extra = (int)wp->w_buffer->b_p_ts - vcol % (int)wp->w_buffer->b_p_ts - 1; } - c_extra = ' '; + c_extra = mb_off > 0 ? MB_FILLER_CHAR : ' '; if (ascii_iswhite(c)) { if (c == TAB) /* See "Tab alignment" below. */ |