mirror of
https://github.com/neovim/neovim.git
synced 2025-12-02 23:13:01 +00:00
feat(ui): add chdir UI event (#27093)
When an embedded Nvim instance changes its current directory a "chdir" UI event is emitted. Attached UIs can use this information however they wish. In the TUI it is used to synchronize the cwd of the TUI process with the cwd of the embedded Nvim process.
This commit is contained in:
@@ -140,6 +140,7 @@ function Screen.new(width, height)
|
||||
suspended = false,
|
||||
mode = 'normal',
|
||||
options = {},
|
||||
pwd = '',
|
||||
popupmenu = nil,
|
||||
cmdline = {},
|
||||
cmdline_block = {},
|
||||
@@ -212,7 +213,6 @@ function Screen:attach(options, session)
|
||||
if options.ext_linegrid == nil then
|
||||
options.ext_linegrid = true
|
||||
end
|
||||
|
||||
self._session = session
|
||||
self._options = options
|
||||
self._clear_attrs = (not options.ext_linegrid) and {} or nil
|
||||
@@ -1108,6 +1108,10 @@ function Screen:_handle_option_set(name, value)
|
||||
self.options[name] = value
|
||||
end
|
||||
|
||||
function Screen:_handle_chdir(path)
|
||||
self.pwd = vim.fs.normalize(path, { expand_env = false })
|
||||
end
|
||||
|
||||
function Screen:_handle_popupmenu_show(items, selected, row, col, grid)
|
||||
self.popupmenu = { items = items, pos = selected, anchor = { grid, row, col } }
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user