From df02f9cc37be38b8189991f9e76bfcafa6e271c6 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sat, 29 Jul 2017 01:51:08 +0200 Subject: vim-patch:8.0.0090 fix breakindent bug (original Vim commit-message is bogus) https://github.com/vim/vim/commit/6c896867c4f5d759616028ef7cbfce2a9ed32600 --- src/nvim/screen.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/nvim/screen.c') diff --git a/src/nvim/screen.c b/src/nvim/screen.c index cd4f4de40f..e3a2c1ffec 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -2195,7 +2195,7 @@ win_line ( int change_start = MAXCOL; /* first col of changed area */ int change_end = -1; /* last col of changed area */ colnr_T trailcol = MAXCOL; /* start of trailing spaces */ - int need_showbreak = FALSE; + int need_showbreak = false; // overlong line, skip first x chars int line_attr = 0; /* attribute for the whole line */ matchitem_T *cur; /* points to the match list */ match_T *shl; /* points to search_hl or a match */ @@ -2805,8 +2805,10 @@ win_line ( // draw 'breakindent': indent wrapped text accodringly if (draw_state == WL_BRI - 1 && n_extra == 0) { draw_state = WL_BRI; - if (wp->w_p_bri && row != startrow && filler_lines == 0) { - char_attr = wp->w_hl_attr_normal; // was: hl_attr(HLF_AT); + // if need_showbreak is set, breakindent also applies + if (wp->w_p_bri && (row != startrow || need_showbreak) + && filler_lines == 0) { + char_attr = wp->w_hl_attr_normal; if (diff_hlf != (hlf_T)0) { char_attr = win_hl_attr(wp, diff_hlf); -- cgit From 1bcb3ed0e29e924167c8429fde2338dd9a6c29d4 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sat, 29 Jul 2017 02:26:21 +0200 Subject: vim-patch:8.0.0126 Problem: Display problem with 'foldcolumn' and a wide character. (esiegerman) Solution: Don't use "extra" but an allocated buffer. (Christian Brabandt, closes vim/vim#1310) https://github.com/vim/vim/commit/6270660611a151c5d0f614a5f0248ccdc80ed971 --- src/nvim/screen.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'src/nvim/screen.c') diff --git a/src/nvim/screen.c b/src/nvim/screen.c index e3a2c1ffec..3d558bdbdd 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -2705,13 +2705,18 @@ win_line ( draw_state = WL_FOLD; if (fdc > 0) { - // Draw the 'foldcolumn'. - fill_foldcolumn(extra, wp, false, lnum); - n_extra = fdc; - p_extra = extra; - p_extra[n_extra] = NUL; - c_extra = NUL; - char_attr = win_hl_attr(wp, HLF_FC); + // Draw the 'foldcolumn'. Allocate a buffer, "extra" may + // already be in used. + p_extra_free = xmalloc(12 + 1); + + if (p_extra_free != NULL) { + fill_foldcolumn(p_extra_free, wp, false, lnum); + n_extra = fdc; + p_extra_free[n_extra] = NUL; + p_extra = p_extra_free; + c_extra = NUL; + char_attr = win_hl_attr(wp, HLF_FC); + } } } -- cgit From 49b671f8f1c93dcd317aec464352206cc705748a Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sat, 29 Jul 2017 02:11:31 +0200 Subject: vim-patch:8.0.0290 vim-patch:8.0.0394 vim-patch:8.0.0290: cursor positioning wrong if wide character wraps Problem: If a wide character doesn't fit at the end of the screen line, and the line doesn't fit on the screen, then the cursor position may be wrong. (anliting) Solution: Don't skip over wide character. (Christian Brabandt, closes vim/1408) vim-patch:8.0.0394 Problem: Tabs are not aligned when scrolling horizontally and a Tab doesn't fit. (Axel Bender) Solution: Handle a Tab as a not fitting character. (Christian Brabandt) Also fix that ":redraw" does not scroll horizontally to show the cursor. And fix the test that depended on the old behavior. https://github.com/vim/vim/commit/abc39ab642791ae3d22a524516eeedb673a95d9d --- src/nvim/screen.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'src/nvim/screen.c') diff --git a/src/nvim/screen.c b/src/nvim/screen.c index 3d558bdbdd..27701c4643 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -2112,16 +2112,16 @@ win_line ( bool nochange /* not updating for changed text */ ) { - int col; /* visual column on screen */ - unsigned off; /* offset in ScreenLines/ScreenAttrs */ - int c = 0; /* init for GCC */ - long vcol = 0; /* virtual column (for tabs) */ + int col = 0; // visual column on screen + 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" */ - int row; /* row in the window, excl w_winrow */ - int screen_row; /* row on the screen, incl w_winrow */ + long vcol_prev = -1; // "vcol" of previous character + char_u *line; // current line + char_u *ptr; // current position in "line" + int row; // row in the window, excl w_winrow + int screen_row; // row on the screen, incl w_winrow char_u extra[18]; /* line number and 'fdc' must fit in here */ int n_extra = 0; /* number of extra chars */ @@ -2522,7 +2522,11 @@ win_line ( if (vcol > v) { vcol -= c; ptr = prev_ptr; - n_skip = v - vcol; + // If the character fits on the screen, don't need to skip it. + // Except for a TAB. + if (((*mb_ptr2cells)(ptr) >= c || *ptr == TAB) && col == 0) { + n_skip = v - vcol; + } } /* -- cgit From cddd4e613e2fefaa1c3fe8c20617f5ee02845617 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sat, 29 Jul 2017 01:44:58 +0200 Subject: vim-patch:8.0.0518 Closes #7086 Problem: Storing a zero byte from a multi-byte character causes fold text to show up wrong. Solution: Avoid putting zero in ScreenLines. (Christian Brabandt, closes vim/vim#1567) https://github.com/vim/vim/commit/c6cd8409c2993b1476e123fba11cb4b8d743b896 --- src/nvim/screen.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/nvim/screen.c') diff --git a/src/nvim/screen.c b/src/nvim/screen.c index 27701c4643..c302ac695e 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -1924,10 +1924,14 @@ static void fold_line(win_T *wp, long fold_count, foldinfo_T *foldinfo, linenr_T if (fill_fold >= 0x80) { ScreenLinesUC[off + col] = fill_fold; ScreenLinesC[0][off + col] = 0; - } else + ScreenLines[off + col] = 0x80; // avoid storing zero + } else { ScreenLinesUC[off + col] = 0; + } + col++; + } else { + ScreenLines[off + col++] = fill_fold; } - ScreenLines[off + col++] = fill_fold; } if (text != buf) -- cgit From a0c7e35eeed489840f1d063b3b8265d01024e340 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sat, 29 Jul 2017 02:40:25 +0200 Subject: vim-patch:8.0.0524 Problem: Folds are messed up when 'encodin' is "utf-8". Solution: Also set the fold character when it's not multi-byte. https://github.com/vim/vim/commit/8da1e6cedf839902e15987a98733ebd31b5f1b81 --- src/nvim/screen.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/nvim/screen.c') diff --git a/src/nvim/screen.c b/src/nvim/screen.c index c302ac695e..dd958eec80 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -1927,6 +1927,7 @@ static void fold_line(win_T *wp, long fold_count, foldinfo_T *foldinfo, linenr_T ScreenLines[off + col] = 0x80; // avoid storing zero } else { ScreenLinesUC[off + col] = 0; + ScreenLines[off + col] = fill_fold; } col++; } else { -- cgit From c87dbadc44f7d3705c7cf4e4dc7345da33f63e1a Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sat, 12 Aug 2017 18:22:47 +0200 Subject: vim-patch:8.0.0235 Problem: Memory leak detected when running tests for diff mode. Solution: Free p_extra_free. https://github.com/vim/vim/commit/b031c4ea04eb1e37a873fbb85e90d835aa1e2b1c --- src/nvim/screen.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'src/nvim/screen.c') diff --git a/src/nvim/screen.c b/src/nvim/screen.c index dd958eec80..f8d519ab36 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -2715,17 +2715,15 @@ win_line ( draw_state = WL_FOLD; if (fdc > 0) { // Draw the 'foldcolumn'. Allocate a buffer, "extra" may - // already be in used. + // already be in use. + xfree(p_extra_free); p_extra_free = xmalloc(12 + 1); - - if (p_extra_free != NULL) { - fill_foldcolumn(p_extra_free, wp, false, lnum); - n_extra = fdc; - p_extra_free[n_extra] = NUL; - p_extra = p_extra_free; - c_extra = NUL; - char_attr = win_hl_attr(wp, HLF_FC); - } + fill_foldcolumn(p_extra_free, wp, false, lnum); + n_extra = fdc; + p_extra_free[n_extra] = NUL; + p_extra = p_extra_free; + c_extra = NUL; + char_attr = win_hl_attr(wp, HLF_FC); } } @@ -3526,6 +3524,7 @@ win_line ( p = xmalloc(len + 1); memset(p, ' ', len); p[len] = NUL; + xfree(p_extra_free); p_extra_free = p; for (i = 0; i < tab_len; i++) { mb_char2bytes(lcs_tab2, p); @@ -3641,6 +3640,7 @@ win_line ( memset(p, ' ', n_extra); STRNCPY(p, p_extra + 1, STRLEN(p_extra) - 1); p[n_extra] = NUL; + xfree(p_extra_free); p_extra_free = p_extra = p; } else { n_extra = byte2cells(c) - 1; @@ -4314,6 +4314,7 @@ win_line ( cap_col = 0; } + xfree(p_extra_free); return row; } -- cgit