diff --git a/data/scripts/o b/data/scripts/o index 2180e09..8e20bd9 100755 --- a/data/scripts/o +++ b/data/scripts/o @@ -313,14 +313,19 @@ cmd_prompt() { echo "" local buf="" line + + # Enable bracketed paste mode - terminal sends \e[200~ before and \e[201~ after paste + bind 'set enable-bracketed-paste on' 2>/dev/null + while true; do local prompt_str if [[ -z "$buf" ]]; then - prompt_str=$'\001\033[1m\002>\001\033[0m\002 ' + prompt_str=$'\033[1m>\033[0m ' else prompt_str=" " fi - if ! IFS= read -e -r -p "$prompt_str" line; then + printf '%s' "$prompt_str" + if ! IFS= read -r line; then if [[ -n "$buf" ]]; then history -s "$buf" printf '%s\n' "$buf" | ollie-9p write "$path/prompt" @@ -328,8 +333,9 @@ cmd_prompt() { printf "\n" break fi - # Drain any remaining lines from a multi-line paste (bracketed paste or fast input) - while IFS= read -r -t 0.05 extra_line; do + + # Drain any additional lines that arrived quickly (multi-line paste) + while IFS= read -r -t 0.1 extra_line; do line="$line"$'\n'"$extra_line" done if [[ -z "$buf" && "$line" == /* ]]; then