Patch 8.1.1642 (after 8.1.0374)
Problem: May use uninitialized variable. (Patrick Palka)
Solution: Initialize variables earlier. (closes #4623)
Files: src/screen.c, src/testdir/test_number.vim
*** ../vim-8.1.1641/src/screen.c 2019-07-04 22:59:03.042796075 +0200
--- src/screen.c 2019-07-07 14:25:20.211970400 +0200
***************
*** 607,612 ****
--- 607,613 ----
curwin->w_lines_valid = 0; /* don't use w_lines[].wl_size now */
return FAIL;
}
+ updating_screen = TRUE;
#ifdef FEAT_TEXT_PROP
// Update popup_mask if needed. This may set w_redraw_top and w_redraw_bot
***************
*** 614,620 ****
may_update_popup_mask(type);
#endif
- updating_screen = TRUE;
#ifdef FEAT_SYN_HL
++display_tick; /* let syntax code know we're in a next round of
* display updating */
--- 615,620 ----
***************
*** 3189,3197 ****
int n_skip = 0; /* nr of chars to skip for 'nowrap' */
! int fromcol, tocol; /* start/end of inverting */
! int fromcol_prev = -2; /* start of inverting after cursor */
! int noinvcur = FALSE; /* don't invert the cursor */
pos_T *top, *bot;
int lnum_in_visual_area = FALSE;
pos_T pos;
--- 3189,3198 ----
int n_skip = 0; /* nr of chars to skip for 'nowrap' */
! int fromcol = -10; // start of inverting
! int tocol = MAXCOL; // end of inverting
! int fromcol_prev = -2; // start of inverting after cursor
! int noinvcur = FALSE; // don't invert the cursor
pos_T *top, *bot;
int lnum_in_visual_area = FALSE;
pos_T pos;
***************
*** 3451,3489 ****
#endif
/*
! * handle visual active in this window
*/
- fromcol = -10;
- tocol = MAXCOL;
if (VIsual_active && wp->w_buffer == curwin->w_buffer)
{
- /* Visual is after curwin->w_cursor */
if (LTOREQ_POS(curwin->w_cursor, VIsual))
{
top = &curwin->w_cursor;
bot = &VIsual;
}
! else /* Visual is before curwin->w_cursor */
{
top = &VIsual;
bot = &curwin->w_cursor;
}
lnum_in_visual_area = (lnum >= top->lnum && lnum <= bot->lnum);
! if (VIsual_mode == Ctrl_V) /* block mode */
{
if (lnum_in_visual_area)
{
fromcol = wp->w_old_cursor_fcol;
tocol = wp->w_old_cursor_lcol;
}
}
! else /* non-block mode */
{
if (lnum > top->lnum && lnum <= bot->lnum)
fromcol = 0;
else if (lnum == top->lnum)
{
! if (VIsual_mode == 'V') /* linewise */
fromcol = 0;
else
{
--- 3452,3491 ----
#endif
/*
! * handle Visual active in this window
*/
if (VIsual_active && wp->w_buffer == curwin->w_buffer)
{
if (LTOREQ_POS(curwin->w_cursor, VIsual))
{
+ // Visual is after curwin->w_cursor
top = &curwin->w_cursor;
bot = &VIsual;
}
! else
{
+ // Visual is before curwin->w_cursor
top = &VIsual;
bot = &curwin->w_cursor;
}
lnum_in_visual_area = (lnum >= top->lnum && lnum <= bot->lnum);
! if (VIsual_mode == Ctrl_V)
{
+ // block mode
if (lnum_in_visual_area)
{
fromcol = wp->w_old_cursor_fcol;
tocol = wp->w_old_cursor_lcol;
}
}
! else
{
+ // non-block mode
if (lnum > top->lnum && lnum <= bot->lnum)
fromcol = 0;
else if (lnum == top->lnum)
{
! if (VIsual_mode == 'V') // linewise
fromcol = 0;
else
{
*** ../vim-8.1.1641/src/testdir/test_number.vim 2019-01-09 23:00:58.001176090 +0100
--- src/testdir/test_number.vim 2019-07-07 14:23:29.928519746 +0200
***************
*** 252,254 ****
--- 252,265 ----
call s:compare_lines(expect, lines)
call s:close_windows()
endfunc
+
+ " This was causing a memcheck error
+ func Test_relativenumber_uninitialised()
+ new
+ set rnu
+ call setline(1, ["a", "b"])
+ redraw
+ call feedkeys("j", 'xt')
+ redraw
+ bwipe!
+ endfunc
*** ../vim-8.1.1641/src/version.c 2019-07-07 14:05:18.097959237 +0200
--- src/version.c 2019-07-07 14:25:32.203910652 +0200
***************
*** 779,780 ****
--- 779,782 ----
{ /* Add new patch number below this line */
+ /**/
+ 1642,
/**/
--
CUSTOMER: Well, can you hang around a couple of minutes? He won't be
long.
MORTICIAN: Naaah, I got to go on to Robinson's -- they've lost nine today.
CUSTOMER: Well, when is your next round?
MORTICIAN: Thursday.
DEAD PERSON: I think I'll go for a walk.
The Quest for the Holy Grail (Monty Python)
/// Bram Moolenaar -- Br...@Moolenaar.net --
http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features --
http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language --
http://www.Zimbu.org ///
\\\ help me help AIDS victims --
http://ICCF-Holland.org ///