Skip to content

Commit c1b25c1

Browse files
committed
Split up stdin piping
This splits up the part where we read stdin and where we write it into the pipe. It's a shame that this breaks the consistency of beginning each string append operation with "; ", but we can blame shell "do" syntax for this. The intention of this patch is to make a follow-up patch more clear, that implements batching of updates for downstream consumers.
1 parent 61dcc10 commit c1b25c1

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

autoload/tpipeline.vim

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,8 @@ func tpipeline#fork_job()
173173
let s:restore_left = systemlist("sh -c 'echo \"\"; tmux display-message -p \"#{status-left}\"'")[-1]
174174
let s:restore_right = systemlist("sh -c 'echo \"\"; tmux display-message -p \"#{status-right}\"'")[-1]
175175
endif
176-
let script = printf("export IFS='$\\n'; while read -r l; do echo \"$l\" > '%s'", s:tpipeline_filepath)
177-
if g:tpipeline_split
178-
let script .= printf("; read -r r; echo \"$r\" > '%s'", s:tpipeline_right_filepath)
179-
endif
176+
let script = printf("export IFS='$\\n'; while read -r l; do%s", g:tpipeline_split ? " read -r r;" : "")
177+
let script .= printf(" echo \"$l\" > '%s'%s", s:tpipeline_filepath, g:tpipeline_split ? printf("; echo \"$r\" > '%s'", s:tpipeline_right_filepath) : "")
180178
if g:tpipeline_usepane
181179
" end early if file was truncated so as not to overwrite any titles of panes we may switch to
182180
let script .= "; if [ -z \"$l\" ]; then continue; fi"

0 commit comments

Comments
 (0)