aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/screen.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/screen.c')
-rw-r--r--src/nvim/screen.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/nvim/screen.c b/src/nvim/screen.c
index 4442e7bba6..7a6e3c59c0 100644
--- a/src/nvim/screen.c
+++ b/src/nvim/screen.c
@@ -2063,6 +2063,7 @@ win_line (
unsigned off; /* offset in ScreenLines/ScreenAttrs */
int c = 0; /* init for GCC */
long vcol = 0; /* virtual column (for tabs) */
+ long vcol_sbr = -1; // virtual column after showbreak
long vcol_prev = -1; /* "vcol" of previous character */
char_u *line; /* current line */
char_u *ptr; /* current position in "line" */
@@ -2761,6 +2762,7 @@ win_line (
n_extra = (int)STRLEN(p_sbr);
char_attr = hl_attr(HLF_AT);
need_showbreak = FALSE;
+ vcol_sbr = vcol + MB_CHARLEN(p_sbr);
/* Correct end of highlighted area for 'showbreak',
* required when 'linebreak' is also set. */
if (tocol == vcol)
@@ -3361,9 +3363,16 @@ win_line (
*/
if (c == TAB && (!wp->w_p_list || lcs_tab1)) {
int tab_len = 0;
- /* tab amount depends on current column */
+ long vcol_adjusted = vcol; // removed showbreak length
+ // Only adjust the tab_len, when at the first column after the
+ // showbreak value was drawn.
+ if (*p_sbr != NUL && vcol == vcol_sbr && wp->w_p_wrap) {
+ vcol_adjusted = vcol - MB_CHARLEN(p_sbr);
+ }
+ // tab amount depends on current column
tab_len = (int)wp->w_buffer->b_p_ts
- - vcol % (int)wp->w_buffer->b_p_ts - 1;
+ - vcol_adjusted % (int)wp->w_buffer->b_p_ts - 1;
+
if (!wp->w_p_lbr || !wp->w_p_list) {
n_extra = tab_len;
} else {