mirror of
				https://github.com/neovim/neovim.git
				synced 2025-10-26 12:27:24 +00:00 
			
		
		
		
	fix(extmarks): wrong display when changing text with virt_lines
(cherry picked from commit e3e74c363a)
			
			
This commit is contained in:
		 Ibby
					Ibby
				
			
				
					committed by
					
						![github-actions[bot]](/assets/img/avatar_default.png) github-actions[bot]
						github-actions[bot]
					
				
			
			
				
	
			
			
			![github-actions[bot]](/assets/img/avatar_default.png) github-actions[bot]
						github-actions[bot]
					
				
			
						parent
						
							46fc9d547c
						
					
				
				
					commit
					b353c27338
				
			| @@ -297,7 +297,12 @@ static void changed_common(linenr_T lnum, colnr_T col, linenr_T lnume, linenr_T | |||||||
|           if (wp->w_lines[i].wl_lnum >= lnum) { |           if (wp->w_lines[i].wl_lnum >= lnum) { | ||||||
|             // Do not change wl_lnum at index zero, it is used to |             // Do not change wl_lnum at index zero, it is used to | ||||||
|             // compare with w_topline.  Invalidate it instead. |             // compare with w_topline.  Invalidate it instead. | ||||||
|             if (wp->w_lines[i].wl_lnum < lnume || i == 0) { |             // If the buffer has virt_lines, invalidate the line | ||||||
|  |             // after the changed lines as the virt_lines for a | ||||||
|  |             // changed line may become invalid. | ||||||
|  |             if (i == 0 || wp->w_lines[i].wl_lnum < lnume | ||||||
|  |                 || (wp->w_lines[i].wl_lnum == lnume | ||||||
|  |                     && wp->w_buffer->b_virt_line_blocks > 0)) { | ||||||
|               // line included in change |               // line included in change | ||||||
|               wp->w_lines[i].wl_valid = false; |               wp->w_lines[i].wl_valid = false; | ||||||
|             } else if (xtra != 0) { |             } else if (xtra != 0) { | ||||||
|   | |||||||
| @@ -1971,6 +1971,63 @@ if (h->n_buckets < new_n_buckets) { // expand | |||||||
|     ]]} |     ]]} | ||||||
|   end) |   end) | ||||||
|  |  | ||||||
|  |   it('works when using dd or yyp #23915 #23916', function() | ||||||
|  |     insert([[ | ||||||
|  |       line1 | ||||||
|  |       line2 | ||||||
|  |       line3 | ||||||
|  |       line4 | ||||||
|  |       line5]]) | ||||||
|  |     meths.buf_set_extmark(0, ns, 0, 0, {virt_lines={{{"foo"}}, {{"bar"}}, {{"baz"}}}}) | ||||||
|  |     screen:expect{grid=[[ | ||||||
|  |       line1                                             | | ||||||
|  |       foo                                               | | ||||||
|  |       bar                                               | | ||||||
|  |       baz                                               | | ||||||
|  |       line2                                             | | ||||||
|  |       line3                                             | | ||||||
|  |       line4                                             | | ||||||
|  |       line^5                                             | | ||||||
|  |       {1:~                                                 }| | ||||||
|  |       {1:~                                                 }| | ||||||
|  |       {1:~                                                 }| | ||||||
|  |                                                         | | ||||||
|  |     ]]} | ||||||
|  |  | ||||||
|  |     feed('gg') | ||||||
|  |     feed('dd') | ||||||
|  |     screen:expect{grid=[[ | ||||||
|  |       ^line2                                             | | ||||||
|  |       foo                                               | | ||||||
|  |       bar                                               | | ||||||
|  |       baz                                               | | ||||||
|  |       line3                                             | | ||||||
|  |       line4                                             | | ||||||
|  |       line5                                             | | ||||||
|  |       {1:~                                                 }| | ||||||
|  |       {1:~                                                 }| | ||||||
|  |       {1:~                                                 }| | ||||||
|  |       {1:~                                                 }| | ||||||
|  |                                                         | | ||||||
|  |     ]]} | ||||||
|  |  | ||||||
|  |     feed('yyp') | ||||||
|  |     screen:expect{grid=[[ | ||||||
|  |       line2                                             | | ||||||
|  |       foo                                               | | ||||||
|  |       bar                                               | | ||||||
|  |       baz                                               | | ||||||
|  |       ^line2                                             | | ||||||
|  |       line3                                             | | ||||||
|  |       line4                                             | | ||||||
|  |       line5                                             | | ||||||
|  |       {1:~                                                 }| | ||||||
|  |       {1:~                                                 }| | ||||||
|  |       {1:~                                                 }| | ||||||
|  |                                                         | | ||||||
|  |     ]]} | ||||||
|  |   end) | ||||||
|  |  | ||||||
| end) | end) | ||||||
|  |  | ||||||
| describe('decorations: signs', function() | describe('decorations: signs', function() | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user