mirror of
https://github.com/neovim/neovim.git
synced 2025-10-07 10:26:31 +00:00
vim-patch:8.2.4626: Visual area not updated when removing sign in Visual mode (#17864)
Problem: Visual area not fully updated when removing sign in Visual mode
while scrolling.
Solution: Adjust check for topline. (closes vim/vim#10017)
abb6fbd14d
This commit is contained in:
@@ -938,7 +938,7 @@ static void win_update(win_T *wp, DecorProviders *providers)
|
|||||||
if (mod_top != 0
|
if (mod_top != 0
|
||||||
&& wp->w_topline == mod_top
|
&& wp->w_topline == mod_top
|
||||||
&& (!wp->w_lines[0].wl_valid
|
&& (!wp->w_lines[0].wl_valid
|
||||||
|| wp->w_topline <= wp->w_lines[0].wl_lnum)) {
|
|| wp->w_topline == wp->w_lines[0].wl_lnum)) {
|
||||||
// w_topline is the first changed line and window is not scrolled,
|
// w_topline is the first changed line and window is not scrolled,
|
||||||
// the scrolling from changed lines will be done further down.
|
// the scrolling from changed lines will be done further down.
|
||||||
} else if (wp->w_lines[0].wl_valid
|
} else if (wp->w_lines[0].wl_valid
|
||||||
|
@@ -263,6 +263,27 @@ func Test_display_scroll_at_topline()
|
|||||||
call StopVimInTerminal(buf)
|
call StopVimInTerminal(buf)
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_display_scroll_update_visual()
|
||||||
|
CheckScreendump
|
||||||
|
|
||||||
|
let lines =<< trim END
|
||||||
|
set scrolloff=0
|
||||||
|
call setline(1, repeat(['foo'], 10))
|
||||||
|
call sign_define('foo', { 'text': '>' })
|
||||||
|
call sign_place(1, 'bar', 'foo', bufnr(), { 'lnum': 2 })
|
||||||
|
call sign_place(2, 'bar', 'foo', bufnr(), { 'lnum': 1 })
|
||||||
|
autocmd CursorMoved * if getcurpos()[1] == 2 | call sign_unplace('bar', { 'id': 1 }) | endif
|
||||||
|
END
|
||||||
|
call writefile(lines, 'XupdateVisual.vim')
|
||||||
|
|
||||||
|
let buf = RunVimInTerminal('-S XupdateVisual.vim', #{rows: 8, cols: 60})
|
||||||
|
call term_sendkeys(buf, "VG7kk")
|
||||||
|
call VerifyScreenDump(buf, 'Test_display_scroll_update_visual', {})
|
||||||
|
|
||||||
|
call StopVimInTerminal(buf)
|
||||||
|
call delete('XupdateVisual.vim')
|
||||||
|
endfunc
|
||||||
|
|
||||||
" Test for 'eob' (EndOfBuffer) item in 'fillchars'
|
" Test for 'eob' (EndOfBuffer) item in 'fillchars'
|
||||||
func Test_eob_fillchars()
|
func Test_eob_fillchars()
|
||||||
" default value (skipped)
|
" default value (skipped)
|
||||||
|
@@ -3,15 +3,15 @@ local helpers = require('test.functional.helpers')(after_each)
|
|||||||
local Screen = require('test.functional.ui.screen')
|
local Screen = require('test.functional.ui.screen')
|
||||||
local clear = helpers.clear
|
local clear = helpers.clear
|
||||||
local poke_eventloop = helpers.poke_eventloop
|
local poke_eventloop = helpers.poke_eventloop
|
||||||
|
local exec = helpers.exec
|
||||||
local feed = helpers.feed
|
local feed = helpers.feed
|
||||||
local feed_command = helpers.feed_command
|
local feed_command = helpers.feed_command
|
||||||
|
|
||||||
describe('display', function()
|
describe('display', function()
|
||||||
local screen
|
before_each(clear)
|
||||||
|
|
||||||
it('scroll when modified at topline', function()
|
it('scroll when modified at topline', function()
|
||||||
clear()
|
local screen = Screen.new(20, 4)
|
||||||
screen = Screen.new(20, 4)
|
|
||||||
screen:attach()
|
screen:attach()
|
||||||
screen:set_default_attr_ids({
|
screen:set_default_attr_ids({
|
||||||
[1] = {bold = true},
|
[1] = {bold = true},
|
||||||
@@ -27,5 +27,35 @@ describe('display', function()
|
|||||||
{1:-- INSERT --} |
|
{1:-- INSERT --} |
|
||||||
]])
|
]])
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it('scrolling when modified at topline in Visual mode', function()
|
||||||
|
local screen = Screen.new(60, 8)
|
||||||
|
screen:attach()
|
||||||
|
screen:set_default_attr_ids({
|
||||||
|
[1] = {bold = true}, -- ModeMsg
|
||||||
|
[2] = {background = Screen.colors.LightGrey}, -- Visual
|
||||||
|
[3] = {background = Screen.colors.Grey, foreground = Screen.colors.DarkBlue}, -- SignColumn
|
||||||
|
})
|
||||||
|
|
||||||
|
exec([[
|
||||||
|
set scrolloff=0
|
||||||
|
call setline(1, repeat(['foo'], 10))
|
||||||
|
call sign_define('foo', { 'text': '>' })
|
||||||
|
call sign_place(1, 'bar', 'foo', bufnr(), { 'lnum': 2 })
|
||||||
|
call sign_place(2, 'bar', 'foo', bufnr(), { 'lnum': 1 })
|
||||||
|
autocmd CursorMoved * if getcurpos()[1] == 2 | call sign_unplace('bar', { 'id': 1 }) | endif
|
||||||
|
]])
|
||||||
|
feed('VG7kk')
|
||||||
|
screen:expect([[
|
||||||
|
{3: }^f{2:oo} |
|
||||||
|
{3: }foo |
|
||||||
|
{3: }foo |
|
||||||
|
{3: }foo |
|
||||||
|
{3: }foo |
|
||||||
|
{3: }foo |
|
||||||
|
{3: }foo |
|
||||||
|
{1:-- VISUAL LINE --} |
|
||||||
|
]])
|
||||||
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user