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

E315: ml_get: Invalid lnum: 10 when resizing a (quickfix) window from a filetype autocommand, when splitkeep=screen #11292

Closed
mgedmin opened this issue Oct 5, 2022 · 6 comments
Labels

Comments

@mgedmin
Copy link

mgedmin commented Oct 5, 2022

Steps to reproduce

  1. :set splitkeep=screen
  2. Set up an autocommand like au FileType qf exe "resize" line('$')
  3. Use vim-fugitive's :Ggrep to search for something
  4. Open the quickfix window with :cw
  5. Use :Ggrep again

At this point I get a

E315: ml_get: Invalid lnum: 1

for some line number that corresponds to the previously active quickfix item.

Expected behaviour

New grep results replace old ones, quickfix is resized

Version of Vim

9.0.662

Environment

OS: Ubuntu 22.04 LTS
Terminal: gnome-terminal
TERM: xterm-256color
shell: bash

Logs and stack traces

Error detected while processing function fugitive#GrepCommand[1]..fugitive#Command[77]..function fugitive#GrepCommand[1]..fugitive#Command[7
0]..<SNR>215_GrepSubcommand[52]..<SNR>215_QuickfixCreate[2]..<SNR>215_QuickfixSet[2]..FileType Autocommands for "*"..function <SNR>30_LoadFT
Plugin[18]..script /home/mg/.vim/ftplugin/qf.vim:
line   31:
E315: ml_get: Invalid lnum: 4

Line 31 of https://github.com/mgedmin/dotvim/blob/master/ftplugin/qf.vim#L31 is

exe "resize" line('$')

vim-fugitive's s:QuickfixSet is doing a
call('setqflist', [], ' ', {'title': ':Ggrep ...'})

I was so far unable to reproduce the issue with vim --clean after setting up autocommands and invoking call setqflist().

@mgedmin mgedmin added the bug label Oct 5, 2022
@mgedmin
Copy link
Author

mgedmin commented Oct 5, 2022

I'm also getting the

E315: ml_get: Invalid lnum: 720

whenever I try to use command-t.vim (with let g:CommandTPreferredImplementation='ruby'). This started relatively recently (last couple of weeks? couple of months?). Maybe I ought to git bisect to see which Vim commit introduced the error.

@mgedmin
Copy link
Author

mgedmin commented Oct 5, 2022

Very important bit of information: the E315: ml_get: Invalid lnum error happens only when I :set splitkeep=screen.

Explains why I couldn't reproduce with vim --clean.

@mgedmin mgedmin changed the title E315: ml_get: Invalid lnum: 10 when resizing a quickfix window from a filetype autocommand E315: ml_get: Invalid lnum: 10 when resizing a (quickfix) window from a filetype autocommand, when splitkeep=screen Oct 5, 2022
@brammool
Copy link
Contributor

brammool commented Oct 5, 2022

Can you reproduce this without a plugin? Then we could use that for a regression test.

Since it's related to the 'splitkeep' option: @luukvbaal

@luukvbaal
Copy link
Contributor

Can reproduce, I'll look into it.

luukvbaal added a commit to luukvbaal/vim that referenced this issue Oct 5, 2022
Problem:	'splitkeep' uses old botline when buffer line count changed.
Solution:	Check that buffer line count is larger than botline (Fixes vim#11292).
@luukvbaal
Copy link
Contributor

luukvbaal commented Oct 5, 2022

#11293 fixes the test case, please check that it also fixes your issue(s) @mgedmin.

mgedmin added a commit to mgedmin/dotvim that referenced this issue Oct 5, 2022
Prevents vim/vim#11292, and also (more
importantly) prevents the quickfix from becoming 1 line high when you do
a :Ggrep when quickfix is aleady open.
@mgedmin
Copy link
Author

mgedmin commented Oct 5, 2022

#11293 fixes the test case, please check that it also fixes your issue(s) @mgedmin.

Yep, I can't reproduce either of the E315 errors from vim-fugitive or command-t.vim any more with that PR.

zeertzjq added a commit to luukvbaal/neovim that referenced this issue 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 issue 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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants