From 283fc3ed726b5db3566d7f7ed8cf5c491d96cb3d Mon Sep 17 00:00:00 2001 From: Ian Kelling Date: Sun, 7 Jul 2024 14:42:52 -0400 Subject: [PATCH] emacs fix --- brc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/brc b/brc index 0f7d7e8..b0f0067 100644 --- a/brc +++ b/brc @@ -569,7 +569,7 @@ cl() { echo "no dirs in ~/.cdirs" return 0 fi - read -r -N 1 input + read -sr -N 1 input if [[ $input != $'\n' ]]; then c "${buttondirs[$input]}" fi @@ -3487,8 +3487,12 @@ if [[ $- == *i* ]]; then local ps_char ps_color col tmp - IFS='[;' read -p $'\e[6n' -d R -rs tmp - col="${tmp##*[^0-9]}" + # bash 5.0.17 gives an error when the last command used a process redirect like + # while read -r l; do e $l; done < <(echo ok) + if [[ ! $LC_INSIDE_EMACS && $BASH_VERSION == 5.[123456789]* || $BASH_VERSION == [6789]* ]]; then + IFS='[;' read -p $'\e[6n' -d R -rs tmp ||: + col="${tmp##*[^0-9]}" + fi unset IFS @@ -3563,7 +3567,7 @@ if [[ $- == *i* ]]; then # If the last command was not newline terminated, add a space (so we # can more easily copy the output if needed), and an indicator to # help us not be confused. - if [[ $col != 1 ]]; then + if [[ $col && $col != 1 ]]; then PS1=" \[$term_yellow\]█\[$term_nocolor\]$PS1" fi -- 2.30.2