diff options
author | Felipe Morales <hel.sheep@gmail.com> | 2014-08-16 15:54:26 -0400 |
---|---|---|
committer | Felipe Morales <hel.sheep@gmail.com> | 2014-08-20 08:27:23 -0400 |
commit | 359262d58d7255c695ebf7ee574e444d7cec233d (patch) | |
tree | 9af5068c34121e4bd7c7910b2c11d3f99042fc09 | |
parent | 2e1c74586959e1f023d7d708af55258ba91a929c (diff) | |
download | rneovim-359262d58d7255c695ebf7ee574e444d7cec233d.tar.gz rneovim-359262d58d7255c695ebf7ee574e444d7cec233d.tar.bz2 rneovim-359262d58d7255c695ebf7ee574e444d7cec233d.zip |
vim-patch: 7.4.352
Problem: With 'linebreak' a tab causes a missing line break.
Solution: Count a tab for what it's worth also for shorter lines.
(Christian Brabandt)
-rw-r--r-- | src/nvim/charset.c | 13 | ||||
-rw-r--r-- | src/nvim/version.c | 2 |
2 files changed, 10 insertions, 5 deletions
diff --git a/src/nvim/charset.c b/src/nvim/charset.c index 955f101a61..57c4aec395 100644 --- a/src/nvim/charset.c +++ b/src/nvim/charset.c @@ -972,6 +972,7 @@ int lbr_chartabsize_adv(char_u *line, char_u **s, colnr_T col) int win_lbr_chartabsize(win_T *wp, char_u *line, char_u *s, colnr_T col, int *headp) { colnr_T col2; + colnr_T col_adj = 0; /* col + screen size of tab */ colnr_T colmax; int added; int mb_added = 0; @@ -991,6 +992,9 @@ int win_lbr_chartabsize(win_T *wp, char_u *line, char_u *s, colnr_T col, int *he // First get normal size, without 'linebreak' int size = win_chartabsize(wp, s, col); int c = *s; + if (tab_corr) { + col_adj = size - 1; + } // If 'linebreak' set check at a blank before a non-blank if the line // needs a break here @@ -1003,13 +1007,14 @@ int win_lbr_chartabsize(win_T *wp, char_u *line, char_u *s, colnr_T col, int *he // non-blank after a blank. numberextra = win_col_off(wp); col2 = col; - colmax = (colnr_T)(wp->w_width - numberextra); + colmax = (colnr_T)(wp->w_width - numberextra - col_adj); if (col >= colmax) { - n = colmax + win_col_off2(wp); + colmax += col_adj; + n = colmax + win_col_off2(wp); if (n > 0) { - colmax += (((col - colmax) / n) + 1) * n; + colmax += (((col - colmax) / n) + 1) * n - col_adj; } } @@ -1028,7 +1033,7 @@ int win_lbr_chartabsize(win_T *wp, char_u *line, char_u *s, colnr_T col, int *he col2 += win_chartabsize(wp, s, col2); if (col2 >= colmax) { /* doesn't fit */ - size = colmax - col; + size = colmax - col + col_adj; tab_corr = FALSE; break; } diff --git a/src/nvim/version.c b/src/nvim/version.c index 6a008c1787..5684a3f8d8 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -243,7 +243,7 @@ static int included_patches[] = { //355, //354, 353, - //352, + 352, //351, //350, //349, |