diff options
| author | Jörg Bakker <captaingroove@openmultimedia.org> | 2023-06-16 11:59:25 +0200 |
|---|---|---|
| committer | Randy Palamar <palamar@ualberta.ca> | 2023-07-18 21:06:46 -0600 |
| commit | 80fbb7e1ead4d16f1f4d511d30df18eeb65ceafa (patch) | |
| tree | 106950ed5bdcfbc14b18c6bc8e96df92aa951268 /vis.h | |
| parent | 599ced0bfc378682053484a9658bd59c02c96973 (diff) | |
| download | vis-80fbb7e1ead4d16f1f4d511d30df18eeb65ceafa.tar.gz vis-80fbb7e1ead4d16f1f4d511d30df18eeb65ceafa.tar.xz | |
Add fullscreen param to vis_pipe_collect() and Lua API vis:pipe()
This enables restoring the terminal from a fullscreen command like
curses based program. Use cases are e.g. a file picker based on some
external program like nnn (https://github.com/jarun/nnn).
Diffstat (limited to 'vis.h')
| -rw-r--r-- | vis.h | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -898,6 +898,10 @@ bool vis_prompt_cmd(Vis*, const char *cmd); * If the ``read_stdout`` and ``read_stderr`` callbacks are non-NULL they * will be invoked when output from the forked process is available. * + * If ``fullscreen`` is set to ``true`` the external process is assumed to + * be a fullscreen program (e.g. curses based) and the ui context is + * restored accordingly. + * * @rst * .. warning:: The editor core is blocked until this function returns. * @endrst @@ -906,7 +910,8 @@ bool vis_prompt_cmd(Vis*, const char *cmd); */ int vis_pipe(Vis*, File*, Filerange*, const char *argv[], void *stdout_context, ssize_t (*read_stdout)(void *stdout_context, char *data, size_t len), - void *stderr_context, ssize_t (*read_stderr)(void *stderr_context, char *data, size_t len)); + void *stderr_context, ssize_t (*read_stderr)(void *stderr_context, char *data, size_t len), + bool fullscreen); /** * Pipe a Filerange to an external process, return its exit status and capture @@ -914,12 +919,13 @@ int vis_pipe(Vis*, File*, Filerange*, const char *argv[], * @param argv Argument list, must be ``NULL`` terminated. * @param out Data written to ``stdout``, will be ``NUL`` terminated. * @param err Data written to ``stderr``, will be ``NUL`` terminated. + * @param fullscreen Whether the external process is a fullscreen program (e.g. curses based) * @rst * .. warning:: The pointers stored in ``out`` and ``err`` need to be `free(3)`-ed * by the caller. * @endrst */ -int vis_pipe_collect(Vis*, File*, Filerange*, const char *argv[], char **out, char **err); +int vis_pipe_collect(Vis*, File*, Filerange*, const char *argv[], char **out, char **err, bool fullscreen); /** * @} |
