Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 'nosplitscroll' poblems #11117

Closed
wants to merge 2 commits into from
Closed

Conversation

luukvbaal
Copy link
Contributor

@luukvbaal luukvbaal commented Sep 12, 2022

Problem: w_prev_height may be wrong when adding laststatus or winbar.
Solution: Initialize w_prev_height and update it when setting laststatus or winbar. Also delay initializing firstwin size until after gui has started.

Instead of having a separate case in win_fix_scroll() for when w_prev_height was uninitialized, we now initialize it in win_init_size(). This prevents scrolling for the first split when 'nosplitbelow' is set. Slipped through the cracks as this only happens for the first window in a new tab when the first split is horizontal. Might be considered hair splitting again but I feel this is more correct and not too involved.

I don't think this addresses #11115 yet. Feel free to keep this open and I'll add the fix to that if I find it.
Added a commit that should fix #11115.

Problem:    w_prev_height may be wrong when adding laststatus or winbar.
Solution:   Initialize w_prev_height and update it when setting laststatus or winbar. Also delay intializing firstwin size until after gui has started.
@codecov
Copy link

codecov bot commented Sep 12, 2022

Codecov Report

Merging #11117 (8e1cde6) into master (c9dc03f) will decrease coverage by 0.02%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master   #11117      +/-   ##
==========================================
- Coverage   81.80%   81.77%   -0.03%     
==========================================
  Files         162      162              
  Lines      188276   188294      +18     
  Branches    42822    42826       +4     
==========================================
- Hits       154015   153982      -33     
- Misses      21725    21769      +44     
- Partials    12536    12543       +7     
Flag Coverage Δ
huge-clang-none 82.70% <100.00%> (+<0.01%) ⬆️
huge-gcc-none 54.56% <50.00%> (-0.01%) ⬇️
huge-gcc-testgui ?
huge-gcc-unittests 0.29% <0.00%> (-0.01%) ⬇️
linux 82.39% <100.00%> (-0.09%) ⬇️
mingw-x64-HUGE 76.44% <100.00%> (-0.02%) ⬇️
mingw-x86-HUGE 77.31% <100.00%> (+<0.01%) ⬆️
windows 78.10% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/main.c 83.96% <100.00%> (ø)
src/menu.c 83.02% <100.00%> (+0.01%) ⬆️
src/window.c 88.89% <100.00%> (+0.08%) ⬆️
src/gui_gtk_x11.c 51.11% <0.00%> (-0.52%) ⬇️
src/buffer.c 86.43% <0.00%> (-0.31%) ⬇️
src/optionstr.c 91.07% <0.00%> (-0.27%) ⬇️
src/regexp_nfa.c 89.44% <0.00%> (-0.24%) ⬇️
src/hardcopy.c 76.83% <0.00%> (-0.22%) ⬇️
src/insexpand.c 88.09% <0.00%> (-0.19%) ⬇️
src/screen.c 79.58% <0.00%> (-0.18%) ⬇️
... and 15 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@luukvbaal luukvbaal changed the title w_prev_height may be wrong or unitialized Fix 'nosplitscroll' poblems Sep 12, 2022
@brammool
Copy link
Contributor

One related test is failing, perhaps it is flaky?
From test_window_cmd.vim:
12249
Found errors in Test_splitscroll_with_splits():
12250
command line..script /home/runner/work/vim/vim/src/testdir/runtest.vim[469]..function RunTheTest[44]..Test_splitscroll_with_splits line 81: Expected 24 but got 256

@luukvbaal
Copy link
Contributor Author

Yeah I noticed, not sure what could cause it. I have no idea how this test could fail on only a single platform.

@luukvbaal
Copy link
Contributor Author

I've never seen it be flaky while developing the patch. I have had iterations of the patch where it would pass on terminal but fail on gui. It's the first time I've seen it fail on just a single platform so it seems unlikely that it would be flaky...

On second thought I can imagine this change making it flaky. I suspect it has something to do with the reason for my delaying the win_init_size() call. I guess there is another point where the gui size might change(why?). Perhaps we could flag it flaky for just gui?

@luukvbaal
Copy link
Contributor Author

Or perhaps we just need a redraw! somewhere. I must confess I do not quite understand where I need them in that test(and why it can fix it). I did remove some at some point because they it seemed to pass without and it did increase the runtime a lot. But perhaps that's what made it flaky now, at least for gui.

Problem:    Lines are scrolled when snapshot is restored.
Solution:   Call win_fix_scroll() in restore_snapshot() (closes vim#11115).
@luukvbaal
Copy link
Contributor Author

Was able to reproduce some flakiness by running the test with gvim in a floating window(as opposed to tiled by my window manager, which is what I had done up till now). Test seems to pass now with some redraws added in the latest commit. It seems disabling gui scrollbars with 'guioptions' for gvim stops the window from resizing unexpectedly. Might be worth setting guioptions if this test causes more problems but it works for now...

@brammool brammool closed this in 5ed3917 Sep 13, 2022
@lacygoill lacygoill mentioned this pull request Sep 13, 2022
zeertzjq added a commit to luukvbaal/neovim that referenced this pull request Oct 6, 2022
vim-patch:9.0.0445: when opening/closing window text moves up/down

Problem:    When opening/closing window text moves up/down.
Solution:   Add the 'splitscroll' option.  When off text will keep its
            position as much as possible.
vim/vim@29ab524

vim-patch:9.0.0455: a few problems with 'splitscroll'

Problem:    A few problems with 'splitscroll'.
Solution:   Fix 'splitscroll' problems. (Luuk van Baal, closes vim/vim#11117)
vim/vim@5ed3917

vim-patch:9.0.0461: 'scroll' is not always updated

Problem:    'scroll' is not always updated.
Solution:   Call win_init_size() at the right place.
vim/vim@470a141

vim-patch:9.0.0465: cursor moves when cmdwin is closed when 'splitscroll' is off

Problem:    Cursor moves when cmdwin is closed when 'splitscroll' is off.
Solution:   Temporarily set 'splitscroll' when jumping back to the original
            window. (closes vim/vim#11128)
vim/vim@e697d48

vim-patch:9.0.0469: cursor moves if cmdwin is closed when 'splitscroll' is off

Problem:    Cursor moves if cmdwin is closed when 'splitscroll' is off.
Solution:   Skip win_fix_cursor if called when cmdwin is open or closing.
            (Luuk van Baal, closes vim/vim#11134)
vim/vim@3735f11

vim-patch:9.0.0478: test for 'splitscroll' takes too much time

Problem:    Test for 'splitscroll' takes too much time.
Solution:   Only test some of the combinations. (Luuk van Baal, closes vim/vim#11139)
vim/vim@594f9e0

vim-patch:9.0.0486: text scrolled with 'nosplitscroll', autocmd win and help

Problem:    Text scrolled with 'nosplitscroll', autocmd win opened and help
            window closed.
Solution:   Skip win_fix_scroll() in more situations. (Luuk van Baal,
            closes vim/vim#11150)
vim/vim@d5bc762

vim-patch:9.0.0505: various problems with 'nosplitscroll'

Problem:    Various problems with 'nosplitscroll'.
Solution:   Fix 'nosplitscroll' problems. (Luuk van Baal, closes vim/vim#11166)
vim/vim@faf1d41

vim-patch:9.0.0555: scrolling with 'nosplitscroll' in callback changing curwin

Problem:    Scrolling with 'nosplitscroll' in callback changing curwin.
Solution:   Invalidate w_cline_row in the right place. (Luuk van Baal,
            closes vim/vim#11185)
vim/vim@20e5856

vim-patch:9.0.0603: with 'nosplitscroll' folds are not handled correctly

Problem:    With 'nosplitscroll' folds are not handled correctly.
Solution:   Take care of closed folds when moving the cursor. (Luuk van Baal,
            closes vim/vim#11234)
vim/vim@7c1cbb6

vim-patch:9.0.0605: dump file missing

Problem:    Dump file missing.
Solution:   Add the missing dump file. (issue vim/vim#11234)
vim/vim@439a2ba

vim-patch:9.0.0647: the 'splitscroll' option is not a good name

Problem:    The 'splitscroll' option is not a good name.
Solution:   Rename 'splitscroll' to 'splitkeep' and make it a string option,
            also supporting "topline". (Luuk van Baal, closes vim/vim#11258)
vim/vim@13ece2a

vim-patch:9.0.0667: ml_get error when 'splitkeep' is "screen"

Problem:    ml_get error when 'splitkeep' is "screen". (Marius Gedminas)
Solution:   Check the botline is not too large. (Luuk van Baal,
            closes vim/vim#11293, closes vim/vim#11292)
vim/vim@346823d
zeertzjq pushed a commit to neovim/neovim that referenced this pull request Oct 6, 2022
vim-patch:9.0.0445: when opening/closing window text moves up/down

Problem:    When opening/closing window text moves up/down.
Solution:   Add the 'splitscroll' option.  When off text will keep its
            position as much as possible.
vim/vim@29ab524

vim-patch:9.0.0455: a few problems with 'splitscroll'

Problem:    A few problems with 'splitscroll'.
Solution:   Fix 'splitscroll' problems. (Luuk van Baal, closes vim/vim#11117)
vim/vim@5ed3917

vim-patch:9.0.0461: 'scroll' is not always updated

Problem:    'scroll' is not always updated.
Solution:   Call win_init_size() at the right place.
vim/vim@470a141

vim-patch:9.0.0465: cursor moves when cmdwin is closed when 'splitscroll' is off

Problem:    Cursor moves when cmdwin is closed when 'splitscroll' is off.
Solution:   Temporarily set 'splitscroll' when jumping back to the original
            window. (closes vim/vim#11128)
vim/vim@e697d48

vim-patch:9.0.0469: cursor moves if cmdwin is closed when 'splitscroll' is off

Problem:    Cursor moves if cmdwin is closed when 'splitscroll' is off.
Solution:   Skip win_fix_cursor if called when cmdwin is open or closing.
            (Luuk van Baal, closes vim/vim#11134)
vim/vim@3735f11

vim-patch:9.0.0478: test for 'splitscroll' takes too much time

Problem:    Test for 'splitscroll' takes too much time.
Solution:   Only test some of the combinations. (Luuk van Baal, closes vim/vim#11139)
vim/vim@594f9e0

vim-patch:9.0.0486: text scrolled with 'nosplitscroll', autocmd win and help

Problem:    Text scrolled with 'nosplitscroll', autocmd win opened and help
            window closed.
Solution:   Skip win_fix_scroll() in more situations. (Luuk van Baal,
            closes vim/vim#11150)
vim/vim@d5bc762

vim-patch:9.0.0505: various problems with 'nosplitscroll'

Problem:    Various problems with 'nosplitscroll'.
Solution:   Fix 'nosplitscroll' problems. (Luuk van Baal, closes vim/vim#11166)
vim/vim@faf1d41

vim-patch:9.0.0555: scrolling with 'nosplitscroll' in callback changing curwin

Problem:    Scrolling with 'nosplitscroll' in callback changing curwin.
Solution:   Invalidate w_cline_row in the right place. (Luuk van Baal,
            closes vim/vim#11185)
vim/vim@20e5856

vim-patch:9.0.0603: with 'nosplitscroll' folds are not handled correctly

Problem:    With 'nosplitscroll' folds are not handled correctly.
Solution:   Take care of closed folds when moving the cursor. (Luuk van Baal,
            closes vim/vim#11234)
vim/vim@7c1cbb6

vim-patch:9.0.0605: dump file missing

Problem:    Dump file missing.
Solution:   Add the missing dump file. (issue vim/vim#11234)
vim/vim@439a2ba

vim-patch:9.0.0647: the 'splitscroll' option is not a good name

Problem:    The 'splitscroll' option is not a good name.
Solution:   Rename 'splitscroll' to 'splitkeep' and make it a string option,
            also supporting "topline". (Luuk van Baal, closes vim/vim#11258)
vim/vim@13ece2a

vim-patch:9.0.0667: ml_get error when 'splitkeep' is "screen"

Problem:    ml_get error when 'splitkeep' is "screen". (Marius Gedminas)
Solution:   Check the botline is not too large. (Luuk van Baal,
            closes vim/vim#11293, closes vim/vim#11292)
vim/vim@346823d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

With 'nosplitscroll', windows are sometimes unnecessarily scrolled after :colder or :cnewer is executed
2 participants