Skip to content

Commit

Permalink
Split up stdin piping
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
vimpostor committed Apr 12, 2024
1 parent 61dcc10 commit c1b25c1
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions autoload/tpipeline.vim
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,8 @@ func tpipeline#fork_job()
let s:restore_left = systemlist("sh -c 'echo \"\"; tmux display-message -p \"#{status-left}\"'")[-1]
let s:restore_right = systemlist("sh -c 'echo \"\"; tmux display-message -p \"#{status-right}\"'")[-1]
endif
let script = printf("export IFS='$\\n'; while read -r l; do echo \"$l\" > '%s'", s:tpipeline_filepath)
if g:tpipeline_split
let script .= printf("; read -r r; echo \"$r\" > '%s'", s:tpipeline_right_filepath)
endif
let script = printf("export IFS='$\\n'; while read -r l; do%s", g:tpipeline_split ? " read -r r;" : "")
let script .= printf(" echo \"$l\" > '%s'%s", s:tpipeline_filepath, g:tpipeline_split ? printf("; echo \"$r\" > '%s'", s:tpipeline_right_filepath) : "")
if g:tpipeline_usepane
" end early if file was truncated so as not to overwrite any titles of panes we may switch to
let script .= "; if [ -z \"$l\" ]; then continue; fi"
Expand Down

0 comments on commit c1b25c1

Please sign in to comment.