Skip to content

fix: console buffer reuse after terminal open#1953

Open
khaitranhq wants to merge 1 commit into
NeogitOrg:masterfrom
khaitranhq:fix/console-buffer-terminal-reuse
Open

fix: console buffer reuse after terminal open#1953
khaitranhq wants to merge 1 commit into
NeogitOrg:masterfrom
khaitranhq:fix/console-buffer-terminal-reuse

Conversation

@khaitranhq
Copy link
Copy Markdown

Summary

  • Prevent Neogit from reusing a NeogitConsole buffer after nvim_open_term() has turned it into a terminal buffer.
  • Recreate stale terminal-backed console buffers before applying non-terminal buffer options.

Problem

  • Reopening the console could hit E474: Invalid argument when Neogit tried to set buftype = "nofile" on a buffer that was already buftype = "terminal".
  • My environment:
NVIM v0.12.1
Build type: Release
LuaJIT 2.1.1774638290
Run "nvim -V1 -v" for more info

Debian 13.3 on WSL

Fix

  • Add a guard in Buffer.create() that detects terminal-backed reused buffers.
  • Delete and recreate the buffer before applying the standard Neogit buffer options.

Verification

  • Ran make test
  • All tests 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.

1 participant