mirror of
https://github.com/neovim/neovim.git
synced 2025-09-24 20:18:32 +00:00
Merge pull request #23558 from luukvbaal/smoothscroll
vim-patch:9.0.{1530,1533,1542,1543}
This commit is contained in:
@@ -196,17 +196,17 @@ describe('display', function()
|
||||
end)
|
||||
|
||||
-- oldtest: Test_display_long_lastline()
|
||||
it('display "lastline" shows correct text when end of wrapped line is deleted', function()
|
||||
it('"lastline" shows correct text when end of wrapped line is deleted', function()
|
||||
local screen = Screen.new(35, 14)
|
||||
screen:attach()
|
||||
exec([[
|
||||
set display=lastline scrolloff=5
|
||||
set display=lastline smoothscroll scrolloff=0
|
||||
call setline(1, [
|
||||
\'aaaaa'->repeat(100),
|
||||
\'aaaaa'->repeat(500),
|
||||
\'bbbbb '->repeat(7) .. 'ccccc '->repeat(7) .. 'ddddd '->repeat(7)
|
||||
\])
|
||||
]])
|
||||
feed('482|')
|
||||
feed('736|')
|
||||
screen:expect([[
|
||||
<<<aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
|
||||
@@ -219,10 +219,11 @@ describe('display', function()
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaa^aaaaaaaaa|
|
||||
aaaaaaaaaa |
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
|
||||
^aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
|
||||
|
|
||||
]])
|
||||
-- The correct part of the last line is moved into view.
|
||||
feed('D')
|
||||
screen:expect([[
|
||||
<<<aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
|
||||
@@ -236,9 +237,67 @@ describe('display', function()
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaa^a |
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa^a|
|
||||
bbbbb bbbbb bbbbb bbbbb bbbbb bb@@@|
|
||||
|
|
||||
]])
|
||||
-- "w_skipcol" does not change because the topline is still long enough
|
||||
-- to maintain the current skipcol.
|
||||
feed('g04l11gkD')
|
||||
screen:expect([[
|
||||
<<<^a |
|
||||
bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb|
|
||||
bbbbb ccccc ccccc ccccc ccccc cccc|
|
||||
c ccccc ccccc ddddd ddddd ddddd ddd|
|
||||
dd ddddd ddddd ddddd |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
|
|
||||
]])
|
||||
-- "w_skipcol" is reset to bring the entire topline into view because
|
||||
-- the line length is now smaller than the current skipcol + marker.
|
||||
feed('x')
|
||||
screen:expect([[
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
|
||||
aa^a |
|
||||
bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb|
|
||||
bbbbb ccccc ccccc ccccc ccccc cccc|
|
||||
c ccccc ccccc ddddd ddddd ddddd @@@|
|
||||
|
|
||||
]])
|
||||
end)
|
||||
|
||||
-- oldtest: Test_display_cursor_long_line()
|
||||
it("correctly shows line that doesn't fit in the window", function()
|
||||
local screen = Screen.new(75, 8)
|
||||
screen:attach()
|
||||
exec([[
|
||||
call setline(1, ['a', 'bbbbb '->repeat(100), 'c'])
|
||||
norm $j
|
||||
]])
|
||||
screen:expect([[
|
||||
<<<bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb |
|
||||
bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbb|
|
||||
bb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb |
|
||||
bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbb|
|
||||
bb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb |
|
||||
bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbb|
|
||||
bb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb^ |
|
||||
|
|
||||
]])
|
||||
end)
|
||||
end)
|
||||
|
41
test/functional/legacy/normal_spec.lua
Normal file
41
test/functional/legacy/normal_spec.lua
Normal file
@@ -0,0 +1,41 @@
|
||||
local helpers = require('test.functional.helpers')(after_each)
|
||||
local Screen = require('test.functional.ui.screen')
|
||||
local clear = helpers.clear
|
||||
local exec = helpers.exec
|
||||
|
||||
before_each(clear)
|
||||
|
||||
describe('normal', function()
|
||||
-- oldtest: Test_normal_j_below_botline()
|
||||
it([["j" does not skip lines when scrolling below botline and 'foldmethod' is not "manual"]], function()
|
||||
local screen = Screen.new(40, 19)
|
||||
screen:attach()
|
||||
screen:set_default_attr_ids({{foreground = Screen.colors.Brown}})
|
||||
exec([[
|
||||
set number foldmethod=diff scrolloff=0
|
||||
call setline(1, map(range(1, 9), 'repeat(v:val, 200)'))
|
||||
norm Lj
|
||||
]])
|
||||
screen:expect([[
|
||||
{1: 2 }222222222222222222222222222222222222|
|
||||
{1: }222222222222222222222222222222222222|
|
||||
{1: }222222222222222222222222222222222222|
|
||||
{1: }222222222222222222222222222222222222|
|
||||
{1: }222222222222222222222222222222222222|
|
||||
{1: }22222222222222222222 |
|
||||
{1: 3 }333333333333333333333333333333333333|
|
||||
{1: }333333333333333333333333333333333333|
|
||||
{1: }333333333333333333333333333333333333|
|
||||
{1: }333333333333333333333333333333333333|
|
||||
{1: }333333333333333333333333333333333333|
|
||||
{1: }33333333333333333333 |
|
||||
{1: 4 }^444444444444444444444444444444444444|
|
||||
{1: }444444444444444444444444444444444444|
|
||||
{1: }444444444444444444444444444444444444|
|
||||
{1: }444444444444444444444444444444444444|
|
||||
{1: }444444444444444444444444444444444444|
|
||||
{1: }44444444444444444444 |
|
||||
|
|
||||
]])
|
||||
end)
|
||||
end)
|
@@ -556,13 +556,13 @@ describe('smoothscroll', function()
|
||||
|
|
||||
]])
|
||||
-- Test zt/zz/zb that they work properly when a long line is above it
|
||||
feed('zb')
|
||||
feed('zt')
|
||||
screen:expect([[
|
||||
<<<th lots of text with lots of text wit|
|
||||
h lots of text with lots of text with lo|
|
||||
ts of text with lots of text with lots o|
|
||||
f text with lots of text end |
|
||||
^four |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
|
|
||||
]])
|
||||
feed('zz')
|
||||
@@ -574,21 +574,7 @@ describe('smoothscroll', function()
|
||||
~ |
|
||||
|
|
||||
]])
|
||||
feed('zt')
|
||||
screen:expect([[
|
||||
^four |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
|
|
||||
]])
|
||||
-- Repeat the step and move the cursor down again.
|
||||
-- This time, use a shorter long line that is barely long enough to span more
|
||||
-- than one window. Note that the cursor is at the bottom this time because
|
||||
-- Vim prefers to do so if we are scrolling a few lines only.
|
||||
exec("call setline(1, ['one', 'two', 'Line' .. (' with lots of text'->repeat(10)) .. ' end', 'four'])")
|
||||
feed('3Gztj')
|
||||
feed('zb')
|
||||
screen:expect([[
|
||||
<<<th lots of text with lots of text wit|
|
||||
h lots of text with lots of text with lo|
|
||||
@@ -597,6 +583,16 @@ describe('smoothscroll', function()
|
||||
^four |
|
||||
|
|
||||
]])
|
||||
-- Repeat the step and move the cursor down again.
|
||||
-- This time, use a shorter long line that is barely long enough to span more
|
||||
-- than one window. Note that the cursor is at the bottom this time because
|
||||
-- Vim prefers to do so if we are scrolling a few lines only.
|
||||
exec("call setline(1, ['one', 'two', 'Line' .. (' with lots of text'->repeat(10)) .. ' end', 'four'])")
|
||||
-- Currently visible lines were replaced, test that the lines and cursor
|
||||
-- are correctly displayed.
|
||||
screen:expect_unchanged()
|
||||
feed('3Gztj')
|
||||
screen:expect_unchanged()
|
||||
-- Repeat the step but this time start it when the line is smooth-scrolled by
|
||||
-- one line. This tests that the offset calculation is still correct and
|
||||
-- still end up scrolling down to the next line with cursor at bottom of
|
||||
|
Reference in New Issue
Block a user