Compare commits

...

4 Commits

Author SHA1 Message Date
zeertzjq
e429893741 patch 9.0.1667: regression test doesn't fail when fix is reverted
Problem:    Regression test doesn't fail when fix is reverted.
Solution:   Add "n" to 'cpoptions' instead of using :winsize. (closes #12587,
            issue #12528)
2023-06-26 19:02:43 +01:00
Christian Brabandt
a2a90d5e20 patch 9.0.1666: compiler may warn for uninitialized variable
Problem:    Compiler may warn for uninitialized variable.
Solution:   Initialize this_props_len. (Christian Brabandt, closes #12599)
2023-06-26 18:48:09 +01:00
Christian Brabandt
590aae3557 patch 9.0.1665: empty CmdlineEnter autocommand causes errors in Ex mode
Problem:    Empty CmdlineEnter autocommand causes errors in Ex mode.
Solution:   Save and restore ex_pressedreturn. (Christian Brabandt,
            closes # 12581, closes #12578)
2023-06-25 22:34:22 +01:00
fullwaywang
8154e642aa patch 9.0.1664: divide by zero when scrolling with 'smoothscroll' set
Problem:    Divide by zero when scrolling with 'smoothscroll' set.
Solution:   Avoid using a negative width. (closes #12540, closes #12528)
2023-06-24 21:58:09 +01:00
8 changed files with 72 additions and 15 deletions

View File

@@ -2018,7 +2018,6 @@ apply_autocmds_group(
int did_save_redobuff = FALSE;
save_redo_T save_redo;
int save_KeyTyped = KeyTyped;
int save_did_emsg;
ESTACK_CHECK_DECLARATION;
/*
@@ -2310,12 +2309,14 @@ apply_autocmds_group(
else
check_lnums_nested(TRUE);
save_did_emsg = did_emsg;
int save_did_emsg = did_emsg;
int save_ex_pressedreturn = get_pressedreturn();
do_cmdline(NULL, getnextac, (void *)&patcmd,
DOCMD_NOWAIT|DOCMD_VERBOSE|DOCMD_REPEAT);
did_emsg += save_did_emsg;
set_pressedreturn(save_ex_pressedreturn);
if (nesting == 1)
// restore cursor and topline, unless they were changed

View File

@@ -9840,7 +9840,6 @@ is_loclist_cmd(int cmdidx)
}
#endif
#if defined(FEAT_TIMERS) || defined(PROTO)
int
get_pressedreturn(void)
{
@@ -9852,4 +9851,3 @@ set_pressedreturn(int val)
{
ex_pressedreturn = val;
}
#endif

View File

@@ -3626,7 +3626,7 @@ adjust_text_props_for_delete(
int idx;
int line_start;
long line_size;
int this_props_len;
int this_props_len = 0;
char_u *text;
size_t textlen;
int found;

View File

@@ -2591,17 +2591,20 @@ scroll_cursor_bot(int min_scroll, int set_topbot)
(curwin, curwin->w_topline, FALSE);
int skip_lines = 0;
int width1 = curwin->w_width - curwin_col_off();
int width2 = width1 + curwin_col_off2();
// similar formula is used in curs_columns()
if (curwin->w_skipcol > width1)
skip_lines += (curwin->w_skipcol - width1) / width2 + 1;
else if (curwin->w_skipcol > 0)
skip_lines = 1;
top_plines -= skip_lines;
if (top_plines > curwin->w_height)
if (width1 > 0)
{
scrolled += (top_plines - curwin->w_height);
int width2 = width1 + curwin_col_off2();
// similar formula is used in curs_columns()
if (curwin->w_skipcol > width1)
skip_lines += (curwin->w_skipcol - width1) / width2 + 1;
else if (curwin->w_skipcol > 0)
skip_lines = 1;
top_plines -= skip_lines;
if (top_plines > curwin->w_height)
{
scrolled += (top_plines - curwin->w_height);
}
}
}
}

View File

@@ -0,0 +1,19 @@
| +0#af5f00255#ffffff0||+1#0000000&| +0&&@72
|@+0#4040ff13&||+1#0000000&| +0&&@72
|@+0#4040ff13&||+1#0000000&| +0&&@72
|@+0#4040ff13&||+1#0000000&| +0&&@72
|@+0#4040ff13&||+1#0000000&| +0&&@72
|@+0#4040ff13&||+1#0000000&| +0&&@72
|@+0#4040ff13&||+1#0000000&| +0&&@72
|@+0#4040ff13&||+1#0000000&| +0&&@72
|@+0#4040ff13&||+1#0000000&| +0&&@72
|@+0#4040ff13&||+1#0000000&| +0&&@72
|@+0#4040ff13&||+1#0000000&| +0&&@72
|@+0#4040ff13&||+1#0000000&| +0&&@72
|@+0#4040ff13&||+1#0000000&| +0&&@72
|@+0#4040ff13&||+1#0000000&| +0&&@72
|@+0#4040ff13&||+1#0000000&| +0&&@72
|@+0#4040ff13&||+1#0000000&| +0&&@72
>@+0#4040ff13&||+1#0000000&| +0&&@72
|<+3&&| |[+1&&|N|o| |N|a|m|e|]| |[|+|]| @59
| +0&&@74

View File

@@ -239,6 +239,12 @@ func Test_ex_mode_errors()
au! CmdLineEnter
delfunc ExEnterFunc
au CmdlineEnter * :
call feedkeys("gQecho 1\r", 'xt')
au! CmdlineEnter
quit
endfunc

View File

@@ -833,4 +833,26 @@ func Test_smoothscroll_multi_skipcol()
call StopVimInTerminal(buf)
endfunc
" this was dividing by zero bug in scroll_cursor_bot
func Test_smoothscroll_zero_width_scroll_cursor_bot()
CheckScreendump
let lines =<< trim END
silent normal yy
silent normal 19p
set cpoptions+=n
vsplit
vertical resize 0
set foldcolumn=1
set number
set smoothscroll
silent normal 20G
END
call writefile(lines, 'XSmoothScrollZeroBot', 'D')
let buf = RunVimInTerminal('-u NONE -S XSmoothScrollZeroBot', #{rows: 19})
call VerifyScreenDump(buf, 'Test_smoothscroll_zero_bot', {})
call StopVimInTerminal(buf)
endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -695,6 +695,14 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1667,
/**/
1666,
/**/
1665,
/**/
1664,
/**/
1663,
/**/