aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/os/fs.c
diff options
context:
space:
mode:
authorGregory Anders <8965202+gpanders@users.noreply.github.com>2024-01-19 14:51:10 -0600
committerGitHub <noreply@github.com>2024-01-19 14:51:10 -0600
commitd3a8e9217f39c59dd7762bd22a76b8bd03ca85ff (patch)
tree176bbcf0793bab5338614f717f003c385f9c3878 /src/nvim/os/fs.c
parent5a8fe0769cc9c5d8323b073d5c45ee37ce91c049 (diff)
downloadrneovim-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/os/fs.c')
-rw-r--r--src/nvim/os/fs.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/nvim/os/fs.c b/src/nvim/os/fs.c
index 09203990bb..d80539708d 100644
--- a/src/nvim/os/fs.c
+++ b/src/nvim/os/fs.c
@@ -33,6 +33,7 @@
# include <sys/xattr.h>
#endif
+#include "nvim/api/private/helpers.h"
#include "nvim/ascii_defs.h"
#include "nvim/gettext_defs.h"
#include "nvim/globals.h"
@@ -44,6 +45,7 @@
#include "nvim/os/os.h"
#include "nvim/path.h"
#include "nvim/types_defs.h"
+#include "nvim/ui.h"
#include "nvim/vim_defs.h"
#ifdef HAVE_SYS_UIO_H
@@ -90,7 +92,11 @@ int os_chdir(const char *path)
smsg(0, "chdir(%s)", path);
verbose_leave();
}
- return uv_chdir(path);
+ int err = uv_chdir(path);
+ if (err == 0) {
+ ui_call_chdir(cstr_as_string((char *)path));
+ }
+ return err;
}
/// Get the name of current directory.