mirror of
				https://github.com/neovim/neovim.git
				synced 2025-11-04 01:34:25 +00:00 
			
		
		
		
	Merge pull request #17205 from clason/vim-8.2.4214
Vim 8.2.{4214,4215,4217,4219} various illegal memory accesses
			
			
This commit is contained in:
		@@ -1099,6 +1099,9 @@ void ex_copy(linenr_T line1, linenr_T line2, linenr_T n)
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  appended_lines_mark(n, count);
 | 
			
		||||
  if (VIsual_active) {
 | 
			
		||||
    check_pos(curbuf, &VIsual);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  msgmore((long)count);
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -772,7 +772,7 @@ static uint8_t *command_line_enter(int firstc, long count, int indent)
 | 
			
		||||
  ccline.cmdindent = (s->firstc > 0 ? s->indent : 0);
 | 
			
		||||
 | 
			
		||||
  // alloc initial ccline.cmdbuff
 | 
			
		||||
  alloc_cmdbuff(exmode_active ? 250 : s->indent + 1);
 | 
			
		||||
  alloc_cmdbuff(indent + 50);
 | 
			
		||||
  ccline.cmdlen = ccline.cmdpos = 0;
 | 
			
		||||
  ccline.cmdbuff[0] = NUL;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -2801,7 +2801,7 @@ static void yank_copy_line(yankreg_T *reg, struct block_def *bd, size_t y_idx,
 | 
			
		||||
  if (exclude_trailing_space) {
 | 
			
		||||
    int s = bd->textlen + bd->endspaces;
 | 
			
		||||
 | 
			
		||||
    while (ascii_iswhite(*(bd->textstart + s - 1)) && s > 0) {
 | 
			
		||||
    while (s > 0 && ascii_iswhite(*(bd->textstart + s - 1))) {
 | 
			
		||||
      s = s - utf_head_off(bd->textstart, bd->textstart + s - 1) - 1;
 | 
			
		||||
      pnew--;
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -98,4 +98,14 @@ func Test_ex_mode_count_overflow()
 | 
			
		||||
  call delete('Xexmodescript')
 | 
			
		||||
endfunc
 | 
			
		||||
 | 
			
		||||
func Test_ex_mode_large_indent()
 | 
			
		||||
  new
 | 
			
		||||
  set ts=500 ai
 | 
			
		||||
  call setline(1, "\t")
 | 
			
		||||
  exe "normal gQi\<CR>."
 | 
			
		||||
  set ts=8 noai
 | 
			
		||||
  bwipe!
 | 
			
		||||
endfunc
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
" vim: shiftwidth=2 sts=2 expandtab
 | 
			
		||||
 
 | 
			
		||||
@@ -1103,6 +1103,13 @@ func Test_visual_put_blockedit_zy_and_zp()
 | 
			
		||||
  bw!
 | 
			
		||||
endfunc
 | 
			
		||||
 | 
			
		||||
func Test_visual_block_yank_zy()
 | 
			
		||||
  new
 | 
			
		||||
  " this was reading before the start of the line
 | 
			
		||||
  exe "norm o\<C-T>\<Esc>\<C-V>zy"
 | 
			
		||||
  bwipe!
 | 
			
		||||
endfunc
 | 
			
		||||
 | 
			
		||||
func Test_visual_block_with_virtualedit()
 | 
			
		||||
  CheckScreendump
 | 
			
		||||
 | 
			
		||||
@@ -1151,5 +1158,31 @@ func Test_visual_reselect_with_count()
 | 
			
		||||
  call delete('XvisualReselect')
 | 
			
		||||
endfunc
 | 
			
		||||
 | 
			
		||||
" this was leaving the end of the Visual area beyond the end of a line
 | 
			
		||||
func Test_visual_ex_copy_line()
 | 
			
		||||
  new
 | 
			
		||||
  call setline(1, ["aaa", "bbbbbbbbbxbb"])
 | 
			
		||||
  /x
 | 
			
		||||
  exe "normal ggvjfxO"
 | 
			
		||||
  t0
 | 
			
		||||
  normal gNU
 | 
			
		||||
  bwipe!
 | 
			
		||||
endfunc
 | 
			
		||||
 | 
			
		||||
" This was leaving the end of the Visual area beyond the end of a line.
 | 
			
		||||
" Set 'undolevels' to start a new undo block.
 | 
			
		||||
func Test_visual_undo_deletes_last_line()
 | 
			
		||||
  new
 | 
			
		||||
  call setline(1, ["aaa", "ccc", "dyd"])
 | 
			
		||||
  set undolevels=100
 | 
			
		||||
  exe "normal obbbbbbbbbxbb\<Esc>"
 | 
			
		||||
  set undolevels=100
 | 
			
		||||
  /y
 | 
			
		||||
  exe "normal ggvjfxO"
 | 
			
		||||
  undo
 | 
			
		||||
  normal gNU
 | 
			
		||||
  bwipe!
 | 
			
		||||
endfunc
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
" vim: shiftwidth=2 sts=2 expandtab
 | 
			
		||||
 
 | 
			
		||||
@@ -2633,6 +2633,10 @@ static void u_undo_end(bool did_undo, bool absolute, bool quiet)
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (VIsual_active) {
 | 
			
		||||
    check_pos(curbuf, &VIsual);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  smsg_attr_keep(0,
 | 
			
		||||
                 _("%" PRId64 " %s; %s #%" PRId64 "  %s"),
 | 
			
		||||
                 u_oldcount < 0 ? (int64_t)-u_oldcount : (int64_t)u_oldcount,
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user