mirror of
				https://github.com/neovim/neovim.git
				synced 2025-11-04 01:34:25 +00:00 
			
		
		
		
	vim-patch:8.1.2052: using "x" before a closed fold may delete that fold
Problem:    Using "x" before a closed fold may delete that fold.
Solution:   Do not translate 'x' do "dl". (Christian Brabandt, closes vim/vim#4927)
7a9bd7c1e0
			
			
This commit is contained in:
		@@ -6248,8 +6248,15 @@ static void nv_optrans(cmdarg_T *cap)
 | 
			
		||||
    if (cap->count0) {
 | 
			
		||||
      stuffnumReadbuff(cap->count0);
 | 
			
		||||
    }
 | 
			
		||||
    // If on an empty line and using 'x' and "l" is included in the
 | 
			
		||||
    // whichwrap option, do not delete the next line.
 | 
			
		||||
    if (cap->cmdchar == 'x' && vim_strchr(p_ww, 'l') != NULL
 | 
			
		||||
        && gchar_cursor() == NUL) {
 | 
			
		||||
        stuffReadbuff((char *)"dd");
 | 
			
		||||
    } else {
 | 
			
		||||
        stuffReadbuff(ar[strchr(str, (char)cap->cmdchar) - str]);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  cap->opcount = 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -756,3 +756,15 @@ func Test_fold_delete_with_marker()
 | 
			
		||||
  bwipe!
 | 
			
		||||
  bwipe!
 | 
			
		||||
endfunc
 | 
			
		||||
 | 
			
		||||
func Test_fold_delete_with_marker_and_whichwrap()
 | 
			
		||||
  new
 | 
			
		||||
  let content1 = ['']
 | 
			
		||||
  let content2 = ['folded line 1 "{{{1', '  test', '  test2', '  test3', '', 'folded line 2 "{{{1', '  test', '  test2', '  test3']
 | 
			
		||||
  call setline(1, content1 + content2)
 | 
			
		||||
  set fdm=marker ww+=l
 | 
			
		||||
  normal! x
 | 
			
		||||
  call assert_equal(content2, getline(1, '$'))
 | 
			
		||||
  set fdm& ww&
 | 
			
		||||
  bwipe!
 | 
			
		||||
endfunc
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user