diff options
author | Gregory Anders <8965202+gpanders@users.noreply.github.com> | 2024-01-19 14:51:10 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-19 14:51:10 -0600 |
commit | d3a8e9217f39c59dd7762bd22a76b8bd03ca85ff (patch) | |
tree | 176bbcf0793bab5338614f717f003c385f9c3878 /src/nvim/ui.c | |
parent | 5a8fe0769cc9c5d8323b073d5c45ee37ce91c049 (diff) | |
download | rneovim-d3a8e9217f39c59dd7762bd22a76b8bd03ca85ff.tar.gz rneovim-d3a8e9217f39c59dd7762bd22a76b8bd03ca85ff.tar.bz2 rneovim-d3a8e9217f39c59dd7762bd22a76b8bd03ca85ff.zip |
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.
Diffstat (limited to 'src/nvim/ui.c')
-rw-r--r-- | src/nvim/ui.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/nvim/ui.c b/src/nvim/ui.c index 8888535878..316342c028 100644 --- a/src/nvim/ui.c +++ b/src/nvim/ui.c @@ -384,6 +384,12 @@ void ui_attach_impl(UI *ui, uint64_t chanid) ui_refresh_options(); resettitle(); + char cwd[MAXPATHL]; + size_t cwdlen = sizeof(cwd); + if (uv_cwd(cwd, &cwdlen) == 0) { + ui_call_chdir((String){ .data = cwd, .size = cwdlen }); + } + for (UIExtension i = kUIGlobalCount; (int)i < kUIExtCount; i++) { ui_set_ext_option(ui, i, ui->ui_ext[i]); } |