mirror of
				https://github.com/neovim/neovim.git
				synced 2025-10-26 12:27:24 +00:00 
			
		
		
		
	fix(extmarks): draw virt_text below diff filler lines properly (#25170)
fix(extmarks): draw virt_text properly below diff filler lines
This commit is contained in:
		| @@ -3082,7 +3082,8 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool number_onl | |||||||
|       wlv.char_attr = saved_attr2; |       wlv.char_attr = saved_attr2; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     if (has_decor && (wp->w_p_rl ? (wlv.col < 0) : (wlv.col >= grid->cols))) { |     if (has_decor && wlv.filler_todo <= 0 | ||||||
|  |         && (wp->w_p_rl ? (wlv.col < 0) : (wlv.col >= grid->cols))) { | ||||||
|       // At the end of screen line: might need to peek for decorations just after |       // At the end of screen line: might need to peek for decorations just after | ||||||
|       // this position. |       // this position. | ||||||
|       if (!has_fold && wp->w_p_wrap && wlv.n_extra == 0) { |       if (!has_fold && wp->w_p_wrap && wlv.n_extra == 0) { | ||||||
| @@ -3119,7 +3120,7 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool number_onl | |||||||
|       if (virt_line_offset >= 0) { |       if (virt_line_offset >= 0) { | ||||||
|         draw_virt_text_item(buf, virt_line_offset, kv_A(virt_lines, virt_line_index).line, |         draw_virt_text_item(buf, virt_line_offset, kv_A(virt_lines, virt_line_index).line, | ||||||
|                             kHlModeReplace, grid->cols, 0); |                             kHlModeReplace, grid->cols, 0); | ||||||
|       } else { |       } else if (wlv.filler_todo <= 0) { | ||||||
|         draw_virt_text(wp, buf, win_col_offset, &draw_col, grid->cols, wlv.row); |         draw_virt_text(wp, buf, win_col_offset, &draw_col, grid->cols, wlv.row); | ||||||
|       } |       } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -692,6 +692,11 @@ describe('extmark decorations', function() | |||||||
|       [34] = {background = Screen.colors.Yellow}; |       [34] = {background = Screen.colors.Yellow}; | ||||||
|       [35] = {background = Screen.colors.Yellow, bold = true, foreground = Screen.colors.Blue}; |       [35] = {background = Screen.colors.Yellow, bold = true, foreground = Screen.colors.Blue}; | ||||||
|       [36] = {foreground = Screen.colors.Blue1, bold = true, background = Screen.colors.Red}; |       [36] = {foreground = Screen.colors.Blue1, bold = true, background = Screen.colors.Red}; | ||||||
|  |       [37] = {background = Screen.colors.WebGray, foreground = Screen.colors.DarkBlue}; | ||||||
|  |       [38] = {background = Screen.colors.LightBlue}; | ||||||
|  |       [39] = {foreground = Screen.colors.Blue1, background = Screen.colors.LightCyan1, bold = true}; | ||||||
|  |       [40] = {reverse = true}; | ||||||
|  |       [41] = {bold = true, reverse = true}; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     ns = meths.create_namespace 'test' |     ns = meths.create_namespace 'test' | ||||||
| @@ -1356,6 +1361,38 @@ describe('extmark decorations', function() | |||||||
|     ]]} |     ]]} | ||||||
|   end) |   end) | ||||||
|  |  | ||||||
|  |   it('virtual text works below diff filler lines', function() | ||||||
|  |     screen:try_resize(53, 8) | ||||||
|  |     insert([[ | ||||||
|  |       aaaaa | ||||||
|  |       bbbbb | ||||||
|  |       ccccc | ||||||
|  |       ddddd | ||||||
|  |       eeeee]]) | ||||||
|  |     command('rightbelow vnew') | ||||||
|  |     insert([[ | ||||||
|  |       bbbbb | ||||||
|  |       ccccc | ||||||
|  |       ddddd | ||||||
|  |       eeeee]]) | ||||||
|  |     command('windo diffthis') | ||||||
|  |     meths.buf_set_extmark(0, ns, 0, 0, { virt_text = {{'AA', 'Underlined'}}, virt_text_pos = 'overlay' }) | ||||||
|  |     meths.buf_set_extmark(0, ns, 0, 0, { virt_text = {{'BB', 'Underlined'}}, virt_text_win_col = 10 }) | ||||||
|  |     meths.buf_set_extmark(0, ns, 0, 0, { virt_text = {{'CC', 'Underlined'}}, virt_text_pos = 'right_align' }) | ||||||
|  |     screen:expect{grid=[[ | ||||||
|  |       {37:  }{38:aaaaa                   }│{37:  }{39:------------------------}| | ||||||
|  |       {37:  }bbbbb                   │{37:  }{28:AA}bbb     {28:BB}          {28:CC}| | ||||||
|  |       {37:  }ccccc                   │{37:  }ccccc                   | | ||||||
|  |       {37:  }ddddd                   │{37:  }ddddd                   | | ||||||
|  |       {37:  }eeeee                   │{37:  }eeee^e                   | | ||||||
|  |       {1:~                         }│{1:~                         }| | ||||||
|  |       {40:[No Name] [+]              }{41:[No Name] [+]             }| | ||||||
|  |                                                            | | ||||||
|  |     ]]} | ||||||
|  |     command('windo set wrap') | ||||||
|  |     screen:expect_unchanged() | ||||||
|  |   end) | ||||||
|  |  | ||||||
|   it('can have virtual text which combines foreground and background groups', function() |   it('can have virtual text which combines foreground and background groups', function() | ||||||
|     screen:set_default_attr_ids { |     screen:set_default_attr_ids { | ||||||
|       [1] = {bold=true, foreground=Screen.colors.Blue}; |       [1] = {bold=true, foreground=Screen.colors.Blue}; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 zeertzjq
					zeertzjq