o prompt: use . as send trigger, empty lines add newlines
This commit is contained in:
parent
19a96ab2de
commit
8ffbf3b699
|
|
@ -252,7 +252,7 @@ cmd_prompt() {
|
|||
path="session/$s/agent/$a"
|
||||
|
||||
echo "[$s/$a]"
|
||||
echo "Enter prompts (blank line sends, Ctrl+D exits)."
|
||||
echo "Type . on a blank line to send, Ctrl+D to exit."
|
||||
echo "Slash commands: /stop /compact /kill /clear /model /backend /cwd /help"
|
||||
echo ""
|
||||
|
||||
|
|
@ -298,10 +298,18 @@ cmd_prompt() {
|
|||
esac
|
||||
continue
|
||||
fi
|
||||
if [[ "$line" == "." ]]; then
|
||||
# Send prompt on "." alone
|
||||
if [[ -n "$buf" ]]; then
|
||||
history -s "$buf"
|
||||
printf '%s\n' "$buf" | ollie-9p write "$path/prompt"
|
||||
buf=""
|
||||
fi
|
||||
continue
|
||||
fi
|
||||
if [[ -z "$line" && -n "$buf" ]]; then
|
||||
history -s "$buf"
|
||||
printf '%s\n' "$buf" | ollie-9p write "$path/prompt"
|
||||
buf=""
|
||||
# Empty line during multi-line input: append newline
|
||||
buf="$buf"$'\n'
|
||||
elif [[ -z "$line" ]]; then
|
||||
continue
|
||||
else
|
||||
|
|
|
|||
Loading…
Reference in New Issue