Am 2014-12-25 14:07, schrieb Dominique Pellé:
(sorry for the PM)
This 2nd patch fixes the case I described. Thanks.
However, a similar bug then happens with 92 columns
after your patch:
$ vim -f -g -u NONE -c 'set showbreak=: columns=92' bug-vim.txt
When pressing A in command mode to append text, the cursor
is after the end of line. It was working fine with 92 columns
prior to your patch. So it's still not right.
We are getting there.
So this only happens, if the TAB is the first char after the showbreak
value
has been drawn, right?
So try this patch.
Kind regards,
Christian
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.
diff --git a/src/screen.c b/src/screen.c
--- a/src/screen.c
+++ b/src/screen.c
@@ -2842,6 +2842,9 @@ win_line(wp, lnum, startrow, endrow, noc
unsigned off; /* offset in ScreenLines/ScreenAttrs */
int c = 0; /* init for GCC */
long vcol = 0; /* virtual column (for tabs) */
+#ifdef FEAT_LINEBREAK
+ long vcol_sbr = 0; /* virtual column after showbreak */
+#endif
long vcol_prev = -1; /* "vcol" of previous character */
char_u *line; /* current line */
char_u *ptr; /* current position in "line" */
@@ -3759,6 +3762,7 @@ win_line(wp, lnum, startrow, endrow, noc
n_extra = (int)STRLEN(p_sbr);
char_attr = hl_attr(HLF_AT);
need_showbreak = FALSE;
+ vcol_sbr = vcol + n_extra;
/* Correct end of highlighted area for 'showbreak',
* required when 'linebreak' is also set. */
if (tocol == vcol)
@@ -4516,9 +4520,16 @@ win_line(wp, lnum, startrow, endrow, noc
if (c == TAB && (!wp->w_p_list || lcs_tab1))
{
int tab_len = 0;
+ long vcol_adjusted = vcol; /* removed showbreak length */
+#ifdef FEAT_LINEBREAK
+ /* 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);
+#endif
/* 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;
#ifdef FEAT_LINEBREAK
if (!wp->w_p_lbr || !wp->w_p_list)
#endif