diff options
author | bfredl <bjorn.linse@gmail.com> | 2022-05-02 23:24:37 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-02 23:24:37 +0200 |
commit | ddf7bb24f98b468d2bc6c16c6f300570fc6530f5 (patch) | |
tree | 8d2c78c2fa94ee7c7bfd40d7cc2f00bc54801eaf /src/nvim/api/ui.c | |
parent | a1542b091dd7b919fa8524c1c909ef897dde9299 (diff) | |
parent | ad63b94b03c166f37bda477db6cbac2a9583d586 (diff) | |
download | rneovim-ddf7bb24f98b468d2bc6c16c6f300570fc6530f5.tar.gz rneovim-ddf7bb24f98b468d2bc6c16c6f300570fc6530f5.tar.bz2 rneovim-ddf7bb24f98b468d2bc6c16c6f300570fc6530f5.zip |
Merge pull request #18357 from bfredl/ui_stdin
feat(ui): allow embedder to emulate "cat data | nvim -" behaviour
Diffstat (limited to 'src/nvim/api/ui.c')
-rw-r--r-- | src/nvim/api/ui.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/nvim/api/ui.c b/src/nvim/api/ui.c index 997f0c218a..f449ccc3c7 100644 --- a/src/nvim/api/ui.c +++ b/src/nvim/api/ui.c @@ -283,6 +283,22 @@ static void ui_set_option(UI *ui, bool init, String name, Object value, Error *e return; } + if (strequal(name.data, "stdin_fd")) { + if (value.type != kObjectTypeInteger || value.data.integer < 0) { + api_set_error(error, kErrorTypeValidation, "stdin_fd must be a non-negative Integer"); + return; + } + + if (starting != NO_SCREEN) { + api_set_error(error, kErrorTypeValidation, + "stdin_fd can only be used with first attached ui"); + return; + } + + stdin_fd = (int)value.data.integer; + return; + } + // LEGACY: Deprecated option, use `ext_cmdline` instead. bool is_popupmenu = strequal(name.data, "popupmenu_external"); |