Skip to content

fix(resession): fix vim.t.bufs arrays restoring as non-contiguous#66

Merged
mehalter merged 1 commit intoAstroNvim:mainfrom
csterlent:fix-session-pull
Feb 18, 2026
Merged

fix(resession): fix vim.t.bufs arrays restoring as non-contiguous#66
mehalter merged 1 commit intoAstroNvim:mainfrom
csterlent:fix-session-pull

Conversation

@csterlent
Copy link
Copy Markdown
Contributor

📑 Description

Astrocore tries to restore all tabs when it loads a session, even the ones that failed resession's buf_tab_filter and did not get saved. When this happens, those missing tabs are placed as nil in the tabpage's vim.t.bufs variable. This can cause error messages, lost tabs, and continuing unexpected behavior.

This PR will make those nil values be ignored, so the array indexes are contiguous.

It is still possible to load in and the current buffer be some unlisted bufnr because of the buf_tab_filter. I recomend that vim.cmd.bf is called somewhere if that happens. Additionally, I noticed that tab-scoped sessions seem to load in without a tabline at the top, with or without the change in this PR.

📖 Additional Information

I attached an error log caused by adding two tabs that get filtered out on session save
:TSModuleInfo
:TSModuleInfo
:q
(Reopen)
Sl
error.log

Copy link
Copy Markdown
Member

@mehalter mehalter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! This is a great improvement

@mehalter mehalter merged commit f7c9515 into AstroNvim:main Feb 18, 2026
9 checks passed
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.

2 participants