mirror of
				https://github.com/neovim/neovim.git
				synced 2025-10-26 12:27:24 +00:00 
			
		
		
		
	fix(shada): restore search pattern length properly (#28929)
This commit is contained in:
		| @@ -1188,6 +1188,7 @@ static void shada_read(ShaDaReadDef *const sd_reader, const int flags) | |||||||
|           .off = cur_entry.data.search_pattern.offset, |           .off = cur_entry.data.search_pattern.offset, | ||||||
|         }, |         }, | ||||||
|         .pat = cur_entry.data.search_pattern.pat, |         .pat = cur_entry.data.search_pattern.pat, | ||||||
|  |         .patlen = strlen(cur_entry.data.search_pattern.pat), | ||||||
|         .additional_data = cur_entry.data.search_pattern.additional_data, |         .additional_data = cur_entry.data.search_pattern.additional_data, | ||||||
|         .timestamp = cur_entry.timestamp, |         .timestamp = cur_entry.timestamp, | ||||||
|       }; |       }; | ||||||
|   | |||||||
| @@ -116,6 +116,12 @@ describe('ShaDa support code', function() | |||||||
|     nvim_feed('gg0n') |     nvim_feed('gg0n') | ||||||
|     eq({ 0, 2, 3, 0 }, fn.getpos('.')) |     eq({ 0, 2, 3, 0 }, fn.getpos('.')) | ||||||
|     eq(1, api.nvim_get_vvar('searchforward')) |     eq(1, api.nvim_get_vvar('searchforward')) | ||||||
|  |     -- Autocommands shouldn't cause search pattern to change | ||||||
|  |     nvim_command('autocmd User * :') | ||||||
|  |     nvim_command('doautocmd User') | ||||||
|  |     nvim_feed('gg0n') | ||||||
|  |     eq({ 0, 2, 3, 0 }, fn.getpos('.')) | ||||||
|  |     eq(1, api.nvim_get_vvar('searchforward')) | ||||||
|   end) |   end) | ||||||
|  |  | ||||||
|   it('dumps and loads last search pattern with offset and backward direction', function() |   it('dumps and loads last search pattern with offset and backward direction', function() | ||||||
| @@ -130,6 +136,12 @@ describe('ShaDa support code', function() | |||||||
|     nvim_feed('G$n') |     nvim_feed('G$n') | ||||||
|     eq({ 0, 2, 3, 0 }, fn.getpos('.')) |     eq({ 0, 2, 3, 0 }, fn.getpos('.')) | ||||||
|     eq(0, api.nvim_get_vvar('searchforward')) |     eq(0, api.nvim_get_vvar('searchforward')) | ||||||
|  |     -- Autocommands shouldn't cause search pattern to change | ||||||
|  |     nvim_command('autocmd User * :') | ||||||
|  |     nvim_command('doautocmd User') | ||||||
|  |     nvim_feed('G$n') | ||||||
|  |     eq({ 0, 2, 3, 0 }, fn.getpos('.')) | ||||||
|  |     eq(0, api.nvim_get_vvar('searchforward')) | ||||||
|   end) |   end) | ||||||
|  |  | ||||||
|   it('saves v:hlsearch=1', function() |   it('saves v:hlsearch=1', function() | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 zeertzjq
					zeertzjq