Commit Graph

54 Commits

Author SHA1 Message Date
bfredl
e61228a214 fix(tests): needing two calls to setup a screen is cringe
Before calling "attach" a screen object is just a dummy container for
(row, col) values whose purpose is to be sent as part of the "attach"
function call anyway.

Just create the screen in an attached state directly. Keep the complete
(row, col, options) config together. It is still completely valid to
later detach and re-attach as needed, including to another session.
2024-11-14 12:40:57 +01:00
zeertzjq
0e484c2041
vim-patch:9.1.0753: Wrong display when typing in diff mode with 'smoothscroll' (#30614)
Problem:  Wrong display when typing in diff mode with 'smoothscroll'.
Solution: Use adjust_plines_for_skipcol() (zeertzjq).

closes: vim/vim#15776

47f8584a80
2024-10-01 22:55:43 +00:00
luukvbaal
97f8d1de1c
vim-patch:9.1.0708: Recursive window update does not account for reset skipcol (#30217)
Problem:  Window is updated with potentially invalid skipcol in recursive
          window update path. I.e. cursor outside of visible range in
          large line that does not fit.
Solution: Make sure it is valid (Luuk van Baal).

3d5065fc75
2024-09-01 20:19:19 +08:00
Luuk van Baal
f178b8ba49 vim-patch:9.1.0414: Unable to leave long line with 'smoothscroll' and 'scrolloff'
Problem:  Unable to leave long line with 'smoothscroll' and 'scrolloff'.
          Corrupted screen near the end of a long line with 'scrolloff'.
          (Ernie Rael, after 9.1.0280)
Solution: Only correct cursor in case scroll_cursor_bot() was not itself
          called to make the cursor visible. Avoid adjusting for
          'scrolloff' beyond the text line height (Luuk van Baal)

b32055e504

vim-patch:9.1.0416: some screen dump tests can be improved

Problem:  some screen dump tests can be improved (after 9.1.0414)
Solution: Make sure screen state changes properly and is captured in the
          screen dumps (Luuk van Baal)

2e642734f4
2024-05-17 20:28:14 +02:00
zeertzjq
e4e230a0cd
vim-patch:9.1.0397: Wrong display with 'smoothscroll' when changing quickfix list (#28674)
Problem:  Wrong display with 'smoothscroll' when changing quickfix list.
Solution: Reset w_skipcol when replacing quickfix list (zeertzjq).

closes: vim/vim#14730

c7a8eb5ff2
2024-05-09 06:11:56 +08:00
dundargoc
052498ed42 test: improve test conventions
Specifically, functions that are run in the context of the test runner
are put in module `test/testutil.lua` while the functions that are run
in the context of the test session are put in
`test/functional/testnvim.lua`.

Closes https://github.com/neovim/neovim/issues/27004.
2024-04-23 18:17:04 +02:00
Lewis Russell
81fc27124b refactor(test): inject after_each differently 2024-04-10 15:53:50 +01:00
dundargoc
7035125b2b test: improve test conventions
Work on https://github.com/neovim/neovim/issues/27004.
2024-04-08 22:51:00 +02:00
Luuk van Baal
4147302f4b vim-patch:9.1.0211: page-wise scrolling does not support smooth-scrolling
Problem:  Page-wise scrolling with Ctrl-F/Ctrl-B implements
          it's own logic to change the topline and cursor.
          In doing so, skipcol is not handled properly for
          'smoothscroll', and virtual lines.
Solution: Re-use the logic from Ctrl-E/Ctrl-Y while staying
          backward compatible as much as possible.

b9f5b95b7b
2024-03-28 10:18:09 +01:00
bfredl
b556bd1a53 refactor(tests): use global defaults instead of set_default_attr_ids (2) 2024-03-27 12:32:53 +01:00
bfredl
0c59771e31 refactor(tests): all screen tests should use highlights
This is the first installment of a multi-PR series significantly
refactoring how highlights are being specified.

The end goal is to have a base set of 20 ish most common highlights,
and then specific files only need to add more groups to that as needed.

As a complicating factor, we also want to migrate to the new default
color scheme eventually. But by sharing a base set, that future PR
will hopefully be a lot smaller since a lot of tests will be migrated
just simply by updating the base set in place.

As a first step, fix the anti-pattern than Screen defaults to ignoring
highlights. Highlights are integral part of the screen state, not
something "extra" which we only test "sometimes". For now, we still
allow opt-out via the intentionally ugly

  screen._default_attr_ids = nil

The end goal is to get rid of all of these eventually (which will be
easier as part of the color scheme migration)
2024-03-23 13:44:35 +01:00
Justin M. Keyes
04f2f864e2 refactor: format test/* 2024-01-03 02:09:29 +01:00
zeertzjq
1037ce2e46 test: avoid repeated screen lines in expected states
This is the command invoked repeatedly to make the changes:

    :%s/^\(.*\)|\%(\*\(\d\+\)\)\?$\n\1|\%(\*\(\d\+\)\)\?$/\=submatch(1)..'|*'..(max([str2nr(submatch(2)),1])+max([str2nr(submatch(3)),1]))/g
2023-12-09 22:15:02 +08:00
zeertzjq
5651c1ff27
vim-patch:9.0.2145: wrong scrolling in insert mode with smoothscroll (#26375)
Problem:  Wrong scrolling in Insert mode with 'smoothscroll' at the
          bottom of the window.
Solution: Don't use set_topline() when 'smoothscroll' is set.

fixes: vim/vim#13612
closes: vim/vim#13613

5b4d1fcbf0
2023-12-04 06:42:47 +08:00
zeertzjq
6952b1951b
vim-patch:9.0.2107: [security]: FPE in adjust_plines_for_skipcol (#26082)
Problem:  [security]: FPE in adjust_plines_for_skipcol
Solution: don't divide by zero, return zero

Prevent a floating point exception when calculating w_skipcol (which can
happen with a small window when the number option is set and cpo+=n).

Add a test to verify

cb0b99f067

Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-11-17 08:40:02 +08:00
luukvbaal
f4d95c05b9
vim-patch:9.0.2105: skipcol not reset when topline changed (#26042)
Problem:  Skipcol is not reset when topline changed scrolling cursor to top
Solution: reset skipcol

closes: vim/vim#13528

bb800a7907
2023-11-15 06:28:56 +08:00
dundargoc
2dc9ceb99c
docs: small fixes (#25585)
Co-authored-by: tmummert <doczook@gmx.de>
Co-authored-by: parikshit adhikari <parikshitadhikari@gmail.com>
2023-10-29 16:02:32 +08:00
zeertzjq
317038e7cb
fix(plines): don't return very large height on very long line (#24260) 2023-07-05 16:30:23 +08:00
zeertzjq
116b09ac04 vim-patch:9.0.1667: regression test doesn't fail when fix is reverted
Problem:    Regression test doesn't fail when fix is reverted.
Solution:   Add "n" to 'cpoptions' instead of using :winsize. (closes vim/vim#12587,
            issue vim/vim#12528)

e429893741
2023-06-27 08:26:11 +08:00
zeertzjq
3b6fb3fefd vim-patch:9.0.1664: divide by zero when scrolling with 'smoothscroll' set
Problem:    Divide by zero when scrolling with 'smoothscroll' set.
Solution:   Avoid using a negative width. (closes vim/vim#12540, closes vim/vim#12528)

8154e642aa

Co-authored-by: fullwaywang <fullwaywang@tencent.com>
2023-06-27 08:26:10 +08:00
zeertzjq
9deef1aa22
vim-patch:9.0.1612: "skipcol" not reset when using multi-byte characters (#23928)
Problem:    "skipcol" not reset when using multi-byte characters.
Solution:   Compare with w_virtcol instead of w_cursor.col. (closes vim/vim#12457)

15d4747ffd

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-06-06 07:13:08 +08:00
zeertzjq
fc908b5006 vim-patch:9.0.1610: display is wrong when 'smoothscroll' is set
Problem:    Display is wrong when 'smoothscroll' is set and scrolling multiple
            lines.
Solution:   Redraw with UPD_NOT_VALID when "skipcol" is or was set.
            (closes vim/vim#12490, closes vim/vim#12468)

d9a92dc70b
2023-06-06 06:37:27 +08:00
zeertzjq
9978a9996d vim-patch:9.0.1603: display wrong if scrolling multiple lines with 'smoothscroll'
Problem:    Display wrong when scrolling multiple lines with 'smoothscroll'
            set.
Solution:   Redraw when w_skipcol changed. (closes vim/vim#12477, closes vim/vim#12468)

3c80227760
2023-06-06 06:37:23 +08:00
zeertzjq
53f30de2be
vim-patch:9.0.1602: stray character visible if marker on top of double-wide char (#23897)
Problem:    Stray character is visible if 'smoothscroll' marker is displayed
            on top of a double-wide character.
Solution:   When overwriting a double-width character with the 'smoothscroll'
            marker clear the second half. (closes vim/vim#12469)

ecb87dd7d3
2023-06-04 07:39:05 +08:00
Luuk van Baal
cf0f83ebf0 vim-patch:9.0.1568: with 'smoothscroll' cursor may move below botline
Problem:    With 'smoothscroll' cursor may move below botline.
Solution:   Call redraw_later() if needed,  Compute cursor row with adjusted
            condition. (Luuk van Baal, closes vim/vim#12415)

d49f646bf5
2023-05-19 19:28:01 +02:00
Luuk van Baal
02ef104d5b vim-patch:9.0.1564: display moves up and down with 'incsearch' and 'smoothscroll'
Problem:    Display moves up and down with 'incsearch' and 'smoothscroll'.
Solution:   Do not check if w_skipcol changed. (Luuk van Baal, closes vim/vim#12410,
            closes vim/vim#12409)

0222c2d103
2023-05-19 18:42:23 +02:00
Luuk van Baal
6f41eaa2b5 vim-patch:9.0.1543: display errors when making topline shorter
Problem:    Display errors when making topline shorter and 'smoothscroll' is
            set.
Solution:   Reset w_skipcol when the topline becomes shorter than its current
            value. (Luuk van Baal, closes vim/vim#12367)

5d01f86d99
2023-05-11 20:57:36 +02:00
Luuk van Baal
d5780e133a vim-patch:9.0.1533: test for 'smoothscroll' is ineffective
Problem:    Test for 'smoothscroll' is ineffective.
Solution:   Change the order of testing "zb" and "zt". (Luuk van Baal,
            closes vim/vim#12366)

6f37e530d3
2023-05-09 22:53:08 +02:00
luukvbaal
44fc2a6d7e
vim-patch:9.0.1525: 'smoothscroll' does not always work properly (#23544)
Problem:    'smoothscroll' does not always work properly.
Solution:   Do not reset w_skipcol after it was intentionally set.  (Luuk van
            Baal, closes vim/vim#12360, closes vim/vim#12199, closes vim/vim#12323)

3ce8c38915
2023-05-09 07:44:31 +08:00
Luuk van Baal
3b2bd8d69e vim-patch:9.0.1512: inserting lines when scrolling with 'smoothscroll' set
Problem:    Inserting lines when scrolling with 'smoothscroll' set.
Solution:   Adjust line height computation for w_skipcol. (Luuk van Baal,
            closes vim/vim#12350)

c8502f9b88
2023-05-07 00:38:40 +02:00
zeertzjq
62ecb05957
vim-patch:9.0.1506: line number not displayed when using 'smoothscroll' (#23453)
Problem:    Line number not displayed when using 'smoothscroll'.
Solution:   Adjust condition for showing the line number. (closes vim/vim#12333)

88bb3e0a48
2023-05-03 07:21:09 +08:00
Luuk van Baal
3b906af27f test: 'smoothscroll' <<< marker shows with tabline, winbar and splits 2023-05-02 13:11:47 +02:00
Luuk van Baal
f78130b2d8 test: 'smoothscroll' works with virt_lines above and below 2023-05-02 13:11:47 +02:00
Luuk van Baal
4e4383ffa2 vim-patch:9.0.1247: divide by zero with 'smoothscroll' set and a narrow window
Problem:    Divide by zero with 'smoothscroll' set and a narrow window.
Solution:   Bail out when the window is too narrow.

870219c58c

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-05-02 13:11:47 +02:00
Luuk van Baal
9b9ccac625 vim-patch:9.0.1121: cursor positioning and display problems with 'smoothscroll'
Problem:    Cursor positioning and display problems with 'smoothscroll' and
            using "zt", "zb" or "zz".
Solution:   Adjust computations and conditions. (Yee Cheng Chin,
            closes vim/vim#11764)

db4d88c2ad

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-05-02 13:11:47 +02:00
Luuk van Baal
6fd7e3bea4 vim-patch:9.0.1000: with 'smoothscroll' skipcol may be reset unnecessarily
Problem:    With 'smoothscroll' skipcol may be reset unnecessarily.
Solution:   Check the line does actually fit in the window.

b21b8e9ed0

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-05-02 13:11:47 +02:00
Luuk van Baal
46646a9bb8 vim-patch:9.0.0908: with 'smoothscroll' cursor may end up in wrong position
Problem:    With 'smoothscroll' cursor may end up in wrong position.
Solution:   Correct the computation of screen lines. (Yee Cheng Chin,
            closes vim/vim#11502)

361895d2a1

Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
2023-05-02 13:11:47 +02:00
Luuk van Baal
3621604029 vim-patch:9.0.0900: cursor moves too far with 'smoothscroll'
Problem:    Cursor moves too far with 'smoothscroll'.
Solution:   Only move as far as really needed. (Yee Cheng Chin, closes vim/vim#11504)

81ba26e9de

Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
2023-05-02 13:11:47 +02:00
Luuk van Baal
0bcf2a6382 vim-patch:9.0.0898: with 'smoothscroll' cursor is one screen line too far down
Problem:    With 'smoothscroll' cursor is one screen line too far down. (Ernie
            Rael)
Solution:   Add a test that currently has the wrong result so that a fix can
            be made. (issue vim/vim#11436)

75ac25b496

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-05-02 13:11:47 +02:00
Luuk van Baal
a2f3855291 vim-patch:9.0.0893: 'smoothscroll' cursor calculations wrong when 'number' is set
Problem:    'smoothscroll' cursor calculations wrong when 'number' is set.
Solution:   Correct the code that computes the width. (closes vim/vim#11492)

01ee52bab6

Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
2023-05-02 13:11:47 +02:00
Luuk van Baal
88d13d2778 vim-patch:9.0.0807: with 'smoothscroll' typing "0" may not go to the first column
Problem:    With 'smoothscroll' typing "0" may not go to the first column.
Solution:   Recompute w_cline_height when needed.  Do not scroll up when it
            would move the cursor.

d5337efece

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-05-02 13:11:47 +02:00
Luuk van Baal
72c525d567 vim-patch:9.0.0758: "precedes" from 'listchars' overwritten by <<<
Problem:    "precedes" from 'listchars' overwritten by <<< for 'smoothscroll'.
Solution:   Keep the "precedes" character.

13cdde3952

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-05-02 13:11:47 +02:00
Luuk van Baal
6146400605 vim-patch:9.0.0757: line number not visisble with 'smoothscroll', 'nu' and 'rnu'
Problem:    Line number not visisble with 'smoothscroll', 'nu' and 'rnu'.
Solution:   Put the ">>>" after the line number instead of on top.

eb4de62931

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-05-02 13:11:47 +02:00
Luuk van Baal
bf12a85a69 vim-patch:9.0.0734: cursor position invalid when scrolling with 'smoothscroll'
Problem:    Cursor position invalid when scrolling with 'smoothscroll' set.
            (Ernie Rael)
Solution:   Add w_valid_skipcol and clear flags when it changes.  Adjust
            w_skipcol after moving the cursor.

2fbabd238a

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-05-02 13:11:47 +02:00
Luuk van Baal
36c98b47a3 vim-patch:9.0.0707: with 'smoothscroll' cursor position not adjusted in long line
Problem:    With 'smoothscroll' and 'scrolloff' non-zero the cursor position
            is not properly adjusted in a long line.
Solution:   Move the cursor further up or down in the line.

118c235112

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-05-02 13:11:47 +02:00
Luuk van Baal
f3de7f4468 vim-patch:9.0.0701: with 'smoothscroll' cursor position not adjusted in long line
Problem:    With 'smoothscroll' the cursor position s not adjusted in a long
            line.
Solution:   Move the cursor further up or down in the line.

8cf3459878

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-05-02 13:11:46 +02:00
Luuk van Baal
d95697d6d4 vim-patch:9.0.0673: first line wong with 'smoothscroll' and 'scrolloff' zero
Problem:    First line not scrolled properly with 'smoothscroll' and
            'scrolloff' zero and using "k".
Solution:   Make sure the cursor position is visible.

46b54747c5

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-05-02 13:11:46 +02:00
Luuk van Baal
3a1973debc vim-patch:9.0.0672: line partly shows with 'smoothscroll' and 'scrolloff' zero
Problem:    Cursor line only partly shows with 'smoothscroll' and 'scrolloff'
            zero.
Solution:   Do not use 'smoothscroll' when adjusting the bottom of the window.
            (closes vim/vim#11269)

9bab7a0243

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-05-02 13:11:46 +02:00
Luuk van Baal
8e4a4629ca vim-patch:9.0.0671: negative topline using CTRL-Y with 'smoothscroll' and 'diff'
Problem:    Negative topline using CTRL-Y with 'smoothscroll' and 'diff'.
            (Ernie Rael)
Solution:   Only use 'smoothscroll' when 'wrap' is set.

1a58e1d97c

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-05-02 13:11:46 +02:00
Luuk van Baal
f3b44cf23d vim-patch:9.0.0652: 'smoothscroll' not tested with 'number' and "n" in 'cpo'
Problem:    'smoothscroll' not tested with 'number' and "n" in 'cpo'.
Solution:   Add tests, fix uncovered problem.

b6aab8f44b

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-05-02 13:11:46 +02:00