[release-0.4] win_update: fix redraw regression (#11027)
Before 6e9ea5adc
`win_ins_lines` would return `FAIL` for `i/line_count == 0`.
Handle this by checking it in the outer `if`.
Ref: https://github.com/neovim/neovim/commit/6e9ea5ad#commitcomment-35084669
This commit is contained in:
parent
43f4955f70
commit
eef3809067
|
@ -871,7 +871,7 @@ static void win_update(win_T *wp)
|
|||
if (wp->w_lines[0].wl_lnum != wp->w_topline)
|
||||
i += diff_check_fill(wp, wp->w_lines[0].wl_lnum)
|
||||
- wp->w_old_topfill;
|
||||
if (i < wp->w_grid.Rows - 2) { // less than a screen off
|
||||
if (i != 0 && i < wp->w_grid.Rows - 2) { // less than a screen off
|
||||
// Try to insert the correct number of lines.
|
||||
// If not the last window, delete the lines at the bottom.
|
||||
// win_ins_lines may fail when the terminal can't do it.
|
||||
|
|
|
@ -3,6 +3,8 @@ local Screen = require('test.functional.ui.screen')
|
|||
|
||||
local feed = helpers.feed
|
||||
local clear = helpers.clear
|
||||
local command = helpers.command
|
||||
local insert = helpers.insert
|
||||
local write_file = helpers.write_file
|
||||
|
||||
describe('Diff mode screen', function()
|
||||
|
@ -957,3 +959,75 @@ int main(int argc, char **argv)
|
|||
end)
|
||||
end)
|
||||
end)
|
||||
|
||||
it('win_update redraws lines properly', function()
|
||||
local screen
|
||||
clear()
|
||||
screen = Screen.new(30, 10)
|
||||
screen:attach()
|
||||
screen:set_default_attr_ids({
|
||||
[1] = {bold = true, foreground = Screen.colors.Blue1},
|
||||
[2] = {foreground = Screen.colors.Grey100, background = Screen.colors.Red},
|
||||
[3] = {background = Screen.colors.Red, foreground = Screen.colors.Grey100, special = Screen.colors.Yellow},
|
||||
[4] = {bold = true, foreground = Screen.colors.SeaGreen4},
|
||||
[5] = {special = Screen.colors.Yellow},
|
||||
[6] = {special = Screen.colors.Yellow, bold = true, foreground = Screen.colors.SeaGreen4},
|
||||
[7] = {foreground = Screen.colors.Grey0, background = Screen.colors.Grey100},
|
||||
[8] = {foreground = Screen.colors.Gray90, background = Screen.colors.Grey100},
|
||||
[9] = {foreground = tonumber('0x00000c'), background = Screen.colors.Grey100},
|
||||
[10] = {background = Screen.colors.Grey100, bold = true, foreground = tonumber('0xe5e5ff')},
|
||||
[11] = {background = Screen.colors.Grey100, bold = true, foreground = tonumber('0x2b8452')},
|
||||
[12] = {bold = true, reverse = true},
|
||||
[13] = {foreground = Screen.colors.DarkBlue, background = Screen.colors.WebGray},
|
||||
[14] = {reverse = true},
|
||||
[15] = {background = Screen.colors.LightBlue},
|
||||
[16] = {background = Screen.colors.LightCyan1, bold = true, foreground = Screen.colors.Blue1},
|
||||
[17] = {bold = true, background = Screen.colors.Red},
|
||||
[18] = {background = Screen.colors.LightMagenta},
|
||||
})
|
||||
|
||||
insert([[
|
||||
1
|
||||
|
||||
|
||||
2
|
||||
1a
|
||||
]])
|
||||
command("vnew")
|
||||
insert([[
|
||||
2
|
||||
2a
|
||||
2b
|
||||
]])
|
||||
command("windo diffthis")
|
||||
command("windo 1")
|
||||
screen:expect{grid=[[
|
||||
{13: }{16:-------}{14:│}{13: }{15:^1 }|
|
||||
{13: }{16:-------}{14:│}{13: }{15: }|
|
||||
{13: }{16:-------}{14:│}{13: }{15: }|
|
||||
{13: }2 {14:│}{13: }2 |
|
||||
{13: }{17:2}{18:a }{14:│}{13: }{17:1}{18:a }|
|
||||
{13: }{15:2b }{14:│}{13: }{16:------------------}|
|
||||
{13: } {14:│}{13: } |
|
||||
{1:~ }{14:│}{1:~ }|
|
||||
{14:<me] [+] }{12:[No Name] [+] }|
|
||||
|
|
||||
]]}
|
||||
feed('<C-e>')
|
||||
feed('<C-e>')
|
||||
feed('<C-y>')
|
||||
feed('<C-y>')
|
||||
feed('<C-y>')
|
||||
screen:expect{grid=[[
|
||||
{13: }{16:-------}{14:│}{13: }{15:1 }|
|
||||
{13: }{16:-------}{14:│}{13: }{15: }|
|
||||
{13: }{16:-------}{14:│}{13: }{15:^ }|
|
||||
{13: }2 {14:│}{13: }2 |
|
||||
{13: }{17:2}{18:a }{14:│}{13: }{17:1}{18:a }|
|
||||
{13: }{15:2b }{14:│}{13: }{16:------------------}|
|
||||
{13: } {14:│}{13: } |
|
||||
{1:~ }{14:│}{1:~ }|
|
||||
{14:<me] [+] }{12:[No Name] [+] }|
|
||||
|
|
||||
]]}
|
||||
end)
|
||||
|
|
Loading…
Reference in New Issue