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

Navigating/deleting windows in multiple tabs causes errors #183

Closed
3 of 6 tasks
Mopp123 opened this issue Aug 4, 2023 · 3 comments · Fixed by #188
Closed
3 of 6 tasks

Navigating/deleting windows in multiple tabs causes errors #183

Mopp123 opened this issue Aug 4, 2023 · 3 comments · Fixed by #188

Comments

@Mopp123
Copy link

Mopp123 commented Aug 4, 2023

Check list

  • I have read through the README (especially F.A.Q section)
  • I have searched through the existing issues

Environment info

  • OS
    • Linux
    • Mac OS X
    • Windows
    • Others:

Version info

VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Jun 22 2023 04:08:04)
Included patches: 1-3995, 4563, 4646, 4774, 4895, 4899, 4901, 4919

Question / Problem and steps to reproduce

Having many tabs and windows open, when deleting the current buffer(not the minimap buffer), sometimes just by quitting window(:q) or in some cases just moving between tabs or windows causes all sorts of different errors.

Error detected while processing WinEnter Autocommands for "*"..function <SNR>26_handle_autocmd[16]..<SNR>26_win_enter_handler[4]..<SNR>26_source_win_enter[2]..<SNR>26_update_highlight[47]..<SNR>26_render_highlight_table:

E957: Invalid window number
E957: Invalid window number
Error detected while processing WinEnter Autocommands for "*"..function <SNR>26_handle_autocmd[16]..<SNR>26_win_enter_handler[4]..<SNR>26_source_win_enter[2]..<SNR>26_update_highlight[14]..<SNR>26_minimap_color_
search[15]..<SNR>26_set_span_color:

E957: Invalid window number
Error detected while processing BufEnter Autocommands for "*"..function <SNR>26_handle_autocmd[23]..<SNR>26_buffer_enter_handler[4]..<SNR>26_source_buffer_enter_handler[3]..<SNR>26_update_highlight[47]..<SNR>26_
render_highlight_table:

E957: Invalid window number

This one happened when switching tab

Error detected while processing WinEnter Autocommands for "*"..function <SNR>26_handle_autocmd[16]..<SNR>26_win_enter_handler[4]..<SNR>26_source_win_enter[2]..<SNR>26_update_highlight[14]..<SNR>26_minimap_color_
search[15]..<SNR>26_set_span_color:

E801: ID already taken: 9295454

Sometimes even when moving cursor inside a file

 Error detected while processing CursorMoved Autocommands for "*"..function <SNR>35_handle_autocmd[29]..<SNR>35_source_win_scroll[14]..<SNR>35_render_highlight_table:

E957: Invalid window number

It wouldn't be so bad if it was only for the errors but sometimes when you have two windows to same buffer, close the other window(:q) it deletes the whole buffer and you may lose some work.

None of this seems to happen if only a single tab open.
Simplest way to produce the first set of errors above is to have two tabs with minimaps open and using :bd on either one.
The other errors I cant produce so consistently since it starts happening just at some point when quickly navigating/deleting windows and tabs.

I absolutely love this plugin and I'd love to start using it without issues in my everyday life.
*Also in autoload/minimap/vim.vim, line 1015:

            if end_location[1] < start_location[1]
                " Error - end not farther than start. Skip.
                continue
            endif

The continue causes infinite loop sometimes again when navigating/deleting windows/tabs if having color search.

@ZNielsen
Copy link
Collaborator

ZNielsen commented Aug 7, 2023

Thanks for reaching out! Sounds like there's two issues here, so I'm going to open a separate one for the possible infinite loop - #184

As for the primary issue of the errors, I don't use multiple tabs when I use vim, so that is definitely an under-tested area. I'm not sure when I'll have time to troubleshoot this since I've not had a lot of open-source time lately, but I'll definitely look at this when I get a chance. If you find any more clues or anything in the meantime please do drop it in here.

PRs are also very welcome if you are feeling inspired/don't want to wait for me to get around to it 😁

@ZNielsen
Copy link
Collaborator

Alright, on investigation I think the simplest thing to do is add a new autocmd that clears our cached values when changing a tab. This prevents stale values (that are now totally nonsensical) from causing issues plus forces a refresh. The cache will continue to be used when switching windows or buffers within one tab, but will be flushed every time a tab change happens.
Are you open to giving it some testing with your workflow before it goes into the main branch? In Plugged, you can switch to the test repo/branch with the following:

Plug 'ZNielsen/minimap.vim', {'branch': 'GH-183_tab_support'}

(Other plugin systems will do this in a similar way, see their docs for info)

I'll be doing some more testing with this, but I would love for you to try it before it's released to make sure you don't encounter any other issues.

@ZNielsen
Copy link
Collaborator

ZNielsen commented Oct 2, 2023

Closing because I think the CR will address the issue. If not, please reopen.

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 a pull request may close this issue.

2 participants