aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/range.lua
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2026-08-15 13:15:37 -0400
committerGitHub <noreply@github.com>2026-08-15 13:15:37 -0400
commitfb180287d0d3068b5873f4a7a39f506b4d52086d (patch)
tree043fe6302e6c443c5cfd7b4275e7a8cca8f2ca10 /runtime/lua/vim/range.lua
parentcd2db7913af68632efb1642b7dafd5cba24bf75c (diff)
downloadrneovim-fb180287d0d3068b5873f4a7a39f506b4d52086d.tar.gz
rneovim-fb180287d0d3068b5873f4a7a39f506b4d52086d.tar.bz2
rneovim-fb180287d0d3068b5873f4a7a39f506b4d52086d.zip
fix(cwd): nvim_win_set_buf of :bcd buf, changes caller CWD #41329
Problem: Setting a :bcd buffer into another window, modifies the caller's CWD. local b = vim.api.nvim_create_buf(true, true) vim.api.nvim_buf_call(b, function() vim.cmd.bcd('..') end) vim.cmd('vsplit') vim.api.nvim_win_set_buf(vim.fn.win_getid(2), b) :echo haslocaldir(0) haslocaldir(-1,0) haslocaldir(-1,-1,0) 0 0 0 :echo getcwd() ==# getcwd(-1,-1) 0 Analysis: `ctx_dirs_save` only saves CWD if it predicts the switch can change it. But win_set_buf() replaces the target window's buffer *after* the switch, which cannot be "predicted" from `ctx_dirs_save`. Solution: Always snapshot whenever the switch enters another window. Skipping `os_dirname` was a micro-optimization.
Diffstat (limited to 'runtime/lua/vim/range.lua')
0 files changed, 0 insertions, 0 deletions