diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2016-11-25 16:46:38 +0100 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2016-11-25 17:07:39 +0100 |
| commit | ab65ab5d027e97ead372264a6ecfd3ac642299ba (patch) | |
| tree | 747a869eadeed1effb902298b90cd828fa7ba806 /sam.c | |
| parent | 1c9c52647fe2984472246eb2c12b3412fd5fafa4 (diff) | |
| download | vis-ab65ab5d027e97ead372264a6ecfd3ac642299ba.tar.gz vis-ab65ab5d027e97ead372264a6ecfd3ac642299ba.tar.xz | |
vis: fix I/O redirection bugs, cleanup vis_pipe
The `:!` command did redirect stdout to a pipe which was used by
`vis-menu` to return the selected entry. However, this breaks
other interactive commands such as `:!/bin/sh` where command
output was never displayed. Instead we modified `vis-menu` to
re-open /dev/tty for its user interface which makes it work
as a regular filter `:|`
This patch also obsoletes the interactive flag previously passed
to the vis_pipe function. Interactive mode is instead enabled
by piping an invalid range.
Diffstat (limited to 'sam.c')
| -rw-r--r-- | sam.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -1398,7 +1398,7 @@ static bool cmd_filter(Vis *vis, Win *win, Command *cmd, const char *argv[], Cur Buffer buferr; buffer_init(&buferr); - int status = vis_pipe(vis, range, false, &argv[1], &filter, read_text, &buferr, read_buffer); + int status = vis_pipe(vis, range, &argv[1], &filter, read_text, &buferr, read_buffer); if (status == 0) { text_delete_range(txt, range); @@ -1422,8 +1422,8 @@ static bool cmd_filter(Vis *vis, Win *win, Command *cmd, const char *argv[], Cur } static bool cmd_launch(Vis *vis, Win *win, Command *cmd, const char *argv[], Cursor *cur, Filerange *range) { - Filerange empty = text_range_new(cur ? view_cursors_pos(cur) : range->start, EPOS); - return cmd_filter(vis, win, cmd, argv, cur, &empty); + Filerange invalid = text_range_new(cur ? view_cursors_pos(cur) : range->start, EPOS); + return cmd_filter(vis, win, cmd, argv, cur, &invalid); } static bool cmd_pipein(Vis *vis, Win *win, Command *cmd, const char *argv[], Cursor *cur, Filerange *range) { @@ -1446,7 +1446,7 @@ static bool cmd_pipeout(Vis *vis, Win *win, Command *cmd, const char *argv[], Cu Buffer buferr; buffer_init(&buferr); - int status = vis_pipe(vis, range, false, (const char*[]){ argv[1], NULL }, NULL, NULL, &buferr, read_buffer); + int status = vis_pipe(vis, range, (const char*[]){ argv[1], NULL }, NULL, NULL, &buferr, read_buffer); if (status == 0 && cur) view_cursors_to(cur, range->start); |
