diff options
Diffstat (limited to 'src/nvim/screen.c')
| -rw-r--r-- | src/nvim/screen.c | 66 | 
1 files changed, 38 insertions, 28 deletions
diff --git a/src/nvim/screen.c b/src/nvim/screen.c index c6d1ea790e..43bc2c1f68 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -3410,7 +3410,7 @@ win_line (              int    i;              int    saved_nextra = n_extra; -            if ((is_concealing || boguscols > 0) && vcol_off > 0) { +            if (vcol_off > 0) {                // there are characters to conceal                tab_len += vcol_off;              } @@ -3440,25 +3440,31 @@ win_line (              // n_extra will be increased by FIX_FOX_BOGUSCOLS              // macro below, so need to adjust for that here -            if ((is_concealing || boguscols > 0) && vcol_off > 0) { +            if (vcol_off > 0) {                n_extra -= vcol_off;              }            } -          /* Tab alignment should be identical regardless of -           * 'conceallevel' value. So tab compensates of all -           * previous concealed characters, and thus resets vcol_off -           * and boguscols accumulated so far in the line. Note that -           * the tab can be longer than 'tabstop' when there -           * are concealed characters. */ -          FIX_FOR_BOGUSCOLS; -          // Make sure that the highlighting for the tab char will be correctly -          // set further below (effectively reverts the FIX_FOR_BOGSUCOLS -          // macro). -          if (old_boguscols > 0 && n_extra > tab_len && wp->w_p_list -              && lcs_tab1) { -            tab_len += n_extra - tab_len; + +          { +            int vc_saved = vcol_off; + +            // Tab alignment should be identical regardless of +            // 'conceallevel' value. So tab compensates of all +            // previous concealed characters, and thus resets +            // vcol_off and boguscols accumulated so far in the +            // line. Note that the tab can be longer than +            // 'tabstop' when there are concealed characters. +            FIX_FOR_BOGUSCOLS; + +            // Make sure, the highlighting for the tab char will be +            // correctly set further below (effectively reverts the +            // FIX_FOR_BOGSUCOLS macro. +            if (n_extra == tab_len + vc_saved && wp->w_p_list && lcs_tab1) { +              tab_len += vc_saved; +            }            } -          mb_utf8 = FALSE;              /* don't draw as UTF-8 */ + +          mb_utf8 = (int)false;  // don't draw as UTF-8            if (wp->w_p_list) {              c = lcs_tab1;              if (wp->w_p_lbr) { @@ -3969,20 +3975,24 @@ win_line (          ScreenAttrs[off] = char_attr;        if (has_mbyte && (*mb_char2cells)(mb_c) > 1) { -        /* Need to fill two screen columns. */ -        ++off; -        ++col; -        if (enc_utf8) -          /* UTF-8: Put a 0 in the second screen char. */ +        // Need to fill two screen columns. +        off++; +        col++; +        if (enc_utf8) { +          // UTF-8: Put a 0 in the second screen char.            ScreenLines[off] = 0; -        else -          /* DBCS: Put second byte in the second screen char. */ +        } else { +          // DBCS: Put second byte in the second screen char.            ScreenLines[off] = mb_c & 0xff; -        ++vcol; -        /* When "tocol" is halfway through a character, set it to the end of -         * the character, otherwise highlighting won't stop. */ -        if (tocol == vcol) -          ++tocol; +        } +        if (draw_state > WL_NR && filler_todo <= 0) { +          vcol++; +        } +        // When "tocol" is halfway through a character, set it to the end of +        // the character, otherwise highlighting won't stop. +        if (tocol == vcol) { +          tocol++; +        }          if (wp->w_p_rl) {            /* now it's time to backup one cell */            --off;  | 
