From 07ec63704ec153b71e10908296046ebd21e6e983 Mon Sep 17 00:00:00 2001 From: Levi Neely Date: Fri, 7 Aug 2026 17:46:35 +0200 Subject: [PATCH] o prompt: drop readline for paste support Switch from 'read -e' to plain 'read' so multi-line paste can be captured. Readline was consuming pasted lines individually. Increase drain timeout to 100ms. --- data/scripts/o | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) 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