mirror of
				https://github.com/neovim/neovim.git
				synced 2025-11-04 09:44:31 +00:00 
			
		
		
		
	fix(drawline): don't draw beyond end of window (#29035)
(cherry picked from commit 9a0239fdc8)
			
			
This commit is contained in:
		
				
					committed by
					
						
						github-actions[bot]
					
				
			
			
				
	
			
			
			
						parent
						
							565fccbeeb
						
					
				
				
					commit
					5d9f2d7ecc
				
			@@ -1596,6 +1596,10 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, int col_rows, s
 | 
			
		||||
        // hide virt_text on text hidden by 'nowrap' or 'smoothscroll'
 | 
			
		||||
        decor_redraw_col(wp, (colnr_T)(ptr - line) - 1, wlv.off, true, &decor_state);
 | 
			
		||||
      }
 | 
			
		||||
      if (wlv.col >= grid->cols) {
 | 
			
		||||
        wlv.col = wlv.off = grid->cols;
 | 
			
		||||
        goto end_check;
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (cul_screenline && wlv.filler_todo <= 0
 | 
			
		||||
@@ -2650,13 +2654,6 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, int col_rows, s
 | 
			
		||||
        conceal_cursor_used = conceal_cursor_line(curwin);
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      // When the window is too narrow draw all "@" lines.
 | 
			
		||||
      if (leftcols_width >= wp->w_grid.cols && is_wrapped) {
 | 
			
		||||
        win_draw_end(wp, schar_from_ascii('@'), true, wlv.row, wp->w_grid.rows, HLF_AT);
 | 
			
		||||
        set_empty_rows(wp, wlv.row);
 | 
			
		||||
        wlv.row = endrow;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      break;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -2844,10 +2841,12 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, int col_rows, s
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
end_check:
 | 
			
		||||
    // At end of screen line and there is more to come: Display the line
 | 
			
		||||
    // so far.  If there is no more to display it is caught above.
 | 
			
		||||
    if (wlv.col >= grid->cols && (!has_foldtext || virt_line_offset >= 0)
 | 
			
		||||
        && (*ptr != NUL
 | 
			
		||||
        && (wlv.col <= leftcols_width
 | 
			
		||||
            || *ptr != NUL
 | 
			
		||||
            || wlv.filler_todo > 0
 | 
			
		||||
            || (wp->w_p_list && wp->w_p_lcs_chars.eol != NUL && lcs_eol_todo)
 | 
			
		||||
            || (wlv.n_extra != 0 && (wlv.sc_extra != NUL || *wlv.p_extra != NUL))
 | 
			
		||||
 
 | 
			
		||||
@@ -4,6 +4,7 @@ local Screen = require('test.functional.ui.screen')
 | 
			
		||||
 | 
			
		||||
local spawn, set_session, clear = n.spawn, n.set_session, n.clear
 | 
			
		||||
local feed, command = n.feed, n.command
 | 
			
		||||
local exec = n.exec
 | 
			
		||||
local insert = n.insert
 | 
			
		||||
local eq = t.eq
 | 
			
		||||
local fn, api = n.fn, n.api
 | 
			
		||||
@@ -819,3 +820,39 @@ it("showcmd doesn't cause empty grid_line with redrawdebug=compositor #22593", f
 | 
			
		||||
  ]],
 | 
			
		||||
  }
 | 
			
		||||
end)
 | 
			
		||||
 | 
			
		||||
it("scrolling in narrow window doesn't draw over separator #29033", function()
 | 
			
		||||
  clear()
 | 
			
		||||
  local screen = Screen.new(60, 8)
 | 
			
		||||
  screen:attach()
 | 
			
		||||
  feed('100Oa<Esc>gg')
 | 
			
		||||
  exec([[
 | 
			
		||||
    set number nowrap
 | 
			
		||||
    vsplit
 | 
			
		||||
    set scrollbind
 | 
			
		||||
    wincmd l
 | 
			
		||||
    set scrollbind
 | 
			
		||||
    wincmd |
 | 
			
		||||
  ]])
 | 
			
		||||
  screen:expect([[
 | 
			
		||||
    {8: }│{8:  1 }^a                                                     |
 | 
			
		||||
    {8: }│{8:  2 }a                                                     |
 | 
			
		||||
    {8: }│{8:  3 }a                                                     |
 | 
			
		||||
    {8: }│{8:  4 }a                                                     |
 | 
			
		||||
    {8: }│{8:  5 }a                                                     |
 | 
			
		||||
    {8: }│{8:  6 }a                                                     |
 | 
			
		||||
    {2:< }{3:[No Name] [+]                                             }|
 | 
			
		||||
                                                                |
 | 
			
		||||
  ]])
 | 
			
		||||
  feed('<C-F>')
 | 
			
		||||
  screen:expect([[
 | 
			
		||||
    {8: }│{8:  5 }^a                                                     |
 | 
			
		||||
    {8: }│{8:  6 }a                                                     |
 | 
			
		||||
    {8: }│{8:  7 }a                                                     |
 | 
			
		||||
    {8: }│{8:  8 }a                                                     |
 | 
			
		||||
    {8: }│{8:  9 }a                                                     |
 | 
			
		||||
    {8: }│{8: 10 }a                                                     |
 | 
			
		||||
    {2:< }{3:[No Name] [+]                                             }|
 | 
			
		||||
                                                                |
 | 
			
		||||
  ]])
 | 
			
		||||
end)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user