From 9aabd12664520f3c518464f149e70fb09a6351da Mon Sep 17 00:00:00 2001 From: Ofir Gal Date: Tue, 22 Feb 2022 21:46:25 +0200 Subject: [PATCH] scanning all history, escaping prompty with quotes --- plugin.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugin.sh b/plugin.sh index 28a4a99..af894c9 100755 --- a/plugin.sh +++ b/plugin.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -x=$(tmux capture-pane -p -J -t !) +x=$(tmux capture-pane -p -S '-' -J -t !) readarray -t pane_contents <<<"$x" # reverse loop through pane contents lines @@ -10,7 +10,7 @@ for (( idx=${#pane_contents[@]}-2 ; idx>=0 ; idx-- )) ; do # strip trailing whitespace from line line=$(sed 's/[[:space:]]*$//' <<<"$line") - if [[ $line =~ $PROMPT_PATTERN ]]; then + if [[ $line =~ "$PROMPT_PATTERN" ]]; then break fi