Skip to content

Commit 69f6804

Browse files
committed
refactor(#2787): replace deprecated
1 parent dde476e commit 69f6804

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

lua/nvim-tree/actions/node/open-file.lua

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,15 @@ local function open_in_new_window(filename, mode)
258258
-- If `hidden` is not enabled, check if buffer in target window is
259259
-- modified, and create new split if it is.
260260
local target_bufid = vim.api.nvim_win_get_buf(target_winid)
261-
if vim.api.nvim_buf_get_option(target_bufid, "modified") then
261+
262+
local modified
263+
if vim.fn.has "nvim-0.10" == 1 then
264+
modified = vim.api.nvim_get_option_value("modified", { buf = target_bufid })
265+
else
266+
modified = vim.api.nvim_buf_get_option(target_bufid, "modified") ---@diagnostic disable-line: deprecated
267+
end
268+
269+
if modified then
262270
if not mode:match "split$" then
263271
mode = "vsplit"
264272
end

0 commit comments

Comments
 (0)