Skip to content
pi-c Artifact [4c65008ca3]
Login

Artifact [4c65008ca3]

Artifact 4c65008ca36f00f745cc70f06137e6654e230304ea3c9e95b180f6e3ee5485fc:


#!/bin/sh
# Terminal UI Pi parity: diffs, thinking, retries, markdown, bang commands, editor keys, queue, and @file.
set -eu
PIC=${PIC:?set PIC to the pic binary}
SERVER=${SERVER:?set SERVER to the fake_server binary}
DRIVE=${DRIVE:?set DRIVE to the pty_drive binary}
FAULTS=yes
[ "${1:-}" = --no-faults ] && FAULTS=no
here=$(cd "$(dirname "$0")" && pwd)
S=$(cd "$here/../pic/streams" && pwd)
V=$(cd "$here/streams" && pwd)
T=$(mktemp -d "${TMPDIR:-/tmp}/pic-tui-editor.XXXXXX")
export HOME="$T/home"
. "$here/tui_lib.sh"

mkdir -p "$HOME/.pic/prompts" "$T/ws"
printf -- '---\ndescription: Say hello\nargument-hint: <who>\n---\nSay hello to $1.\n' > "$HOME/.pic/prompts/greet.md"
drive() { drive_with regular 80 24 "$T/j" "$T/ws" fake/m "$@"; }

# Pi parity, round 1: tool blocks, thinking, history, footer, retries, model keys.
# A second fake server with its own script; the connection order is the test order.
V=$(cd "$(dirname "$0")/streams" && pwd)
mkdir "$T/log2" "$T/ws2" "$T/ws2/.git"
printf 'ref: refs/heads/feature\n' > "$T/ws2/.git/HEAD"
printf 'alpha\nbeta\ngamma\n' > "$T/ws2/e.txt"
"$SERVER" "$T/port2" "$T/log2" 240 "sse:$V/edit.sse" "sse:$V/done.sse" "sse:$V/bash.sse" "hang:$V/done.sse:200" \
    "sse:$V/thinking_text.sse" "sse:$V/thinking_text.sse" "sse:$V/length.sse" "cut:$V/done.sse:420" "hang:$V/done.sse:200" \
    "cut:$V/done.sse:420" "cut:$V/done.sse:420" "cut:$V/done.sse:420" "hang:$V/done.sse:200" "sse:$V/done.sse" &
spid2=$!
bg "$spid2"
i=0
while [ ! -s "$T/port2" ]; do i=$((i + 1)); [ "$i" -lt 600 ] || fail "server 2"; sleep 0.05; done
printf '{"providers":{"fake":{"baseUrl":"http://127.0.0.1:%s","api":"anthropic-messages","apiKey":"$ANTHROPIC_API_KEY","models":[{"id":"m","contextWindow":200000},{"id":"r","contextWindow":200000,"reasoning":true}]}}}' \
    "$(cat "$T/port2")" > "$T/models2.json"
export PIC_MODELS_FILE="$T/models2.json"
drive2() { # NAME [pic args]: the second journal and workspace
    name=$1
    shift
    "$DRIVE" "$T/$name.tx" 80 24 "$PIC" --tui-mode regular --db "$T/j2" --workspace "$T/ws2" --model fake/r "$@" ||
        fail "$name: $(perl -pe 's/\e\[[0-9;?]*[A-Za-z]//g; s/\r//g' "$T/$name.tx" | grep -v '^\s*$' | tail -8)"
}
pic2() { "$PIC" --db "$T/j2" --workspace "$T/ws2" "$@"; }

# An edit is a coloured diff; the block says it took time; the footer has the
# branch, the conversation name and the token counts.
drive2 edit <<'EOF2'
expect pic fake/r
send fix beta\r
expect ✓ edit e.txt
expect -2 beta
expect +2 BETA
expect +3 beta two
expect Took
expect All done.
expect ↑60 ↓40
size 200 24
wait 300
send /name tester\r
expect named tester
expect (feature) • tester
send \x04\x04
EOF2
grep -q '^BETA$' "$T/ws2/e.txt" && grep -q '^beta two$' "$T/ws2/e.txt" || fail "edit: file not edited"
perl -pe 's/\e\[[0-9;?]*[A-Za-z]//g' "$T/edit.tx" | grep -q 'ctrl+o to expand' && fail "edit: a short diff was collapsed"
# Pi's toolDiffRemoved and toolDiffAdded (the red and green of its dark theme), in 256 colours or truecolor by COLORTERM
ESC=$(printf '\033')
grep -aqE "${ESC}\\[38;(5;174|2;234;127;129)m-2 beta" "$T/edit.tx" || fail "edit: removed line not Pi's toolDiffRemoved"
grep -aqE "${ESC}\\[38;(5;72|2;104;183;141)m[+]2 BETA" "$T/edit.tx" || fail "edit: added line not Pi's toolDiffAdded"
printf 'PASS: an edit shows as a coloured diff with its duration; the footer shows branch, name and tokens\n'

# Long output is collapsed with a hint; Ctrl+O expands the block while it is
# still in the live area, and the block is committed in that state.
drive2 collapse <<'EOF2'
expect pic fake/r
send list\r
expect 7 earlier lines, ctrl+o to expand
expect Took
wait 700
send \x0f
expect 101
expect tools expanded
send \e
expect Operation aborted
send \x04\x04
EOF2
printf 'PASS: tool output is collapsed with a hint, and Ctrl+O expands blocks still live\n'

# Thinking stays in the transcript; Ctrl+T hides it behind a one-line marker
# and saves the setting; the setting is read when a reply is committed.
drive2 thinking <<'EOF2'
expect pic fake/r
send ponder\r
expect pondering the answer carefully
expect Done thinking.
expect ↑30 ↓20
wait 400
send \x14
expect thinking blocks: hidden
send again\r
expect Thinking...
expect ↑60 ↓40
wait 400
send \x14
expect thinking blocks: visible
send \x04\x04
EOF2
[ -z "$(pic2 settings hideThinking)" ] || [ "$(pic2 settings hideThinking)" = false ] || fail "thinking: Ctrl+T did not save the setting"
# Pi's thinking text: the thinkingText colour (256 or truecolor by COLORTERM), then italic
grep -a 'pondering the answer carefully' "$T/thinking.tx" | grep -aqE "${ESC}\\[38;(5;[0-9]+|2;[0-9]+;[0-9]+;[0-9]+)m${ESC}\\[3m" || fail "thinking: not thinkingText italic"
printf 'PASS: thinking is kept dim italic in the transcript; Ctrl+T hides it behind a marker and saves hideThinking\n'

# A reply cut at the length limit says so; a failed attempt shows the retry
# status; a request that fails on every attempt says how many were made.
drive2 stops <<'EOF2'
expect pic fake/r
send long\r
expect The long answer starts
expect Response was truncated before completion.
send retry\r
expect Retrying (2/3)
expect (esc to cancel)
waitfile $T/log2/9.req
send \e
expect Operation aborted
wait 1500
send fail\r
expect Retry failed after 3 attempts
send \x04\x04
EOF2
printf 'PASS: a length stop is reported; retries show their status and the final failure counts attempts\n'

# Alt+P and Ctrl+P work while a reply runs and apply from the next request.
drive2 keys <<'EOF2'
expect pic fake/r
send hold\r
expect Working
waitfile $T/log2/13.req
send \x10
expect model
send \ep
expect Select a model
send fake/m
expect →   fake/m
send \r
expect model fake/m
expect fake/m
send \e
expect Operation aborted
send next\r
expect All done.
send \x04\x04
EOF2
grep -q '"model":"m"' "$(ls "$T/log2"/*.req | sort -V | tail -1)" || fail "keys: the next request did not use fake/m"
printf 'PASS: Alt+P and Ctrl+P work while a reply runs and take effect from the next request\n'

# Up/Down recall the messages of the conversation being continued, oldest
# first, after a restart.
drive2 hist1 <<'EOF2'
expect pic fake/r
send first question\r
expect ↑30 ↓20
wait 300
send second question\r
expect ↑60 ↓40
wait 300
send \x04\x04
EOF2
drive2 hist2 tui -c <<'EOF2'
expect continuing
expect second question
wait 300
send \e[A
wait 200
send \e[A
expect first question
wait 100
send \r
expect All done.
send \x04\x04
EOF2
[ "$(grep -o '"first question"' "$(ls "$T/log2"/*.req | sort -V | tail -1)" | wc -l | tr -d ' ')" = 2 ] || fail "history: the recalled message was not sent again"
printf 'PASS: Up recalls the earlier messages of a continued conversation\n'

# Pi parity, round 2: markdown, "!" commands, editor keys, queue, startup. A
# third fake server and workspace; the connection order is the test order.
mkdir "$T/log3" "$T/ws3" "$T/ws3/.pic" "$T/home/.pic/skills" "$T/home/.pic/skills/tui2demo"
printf 'Be kind.\n' > "$T/ws3/AGENTS.md"
printf -- '---\nname: tui2demo\ndescription: A demo skill\n---\nDo the demo.\n' > "$T/home/.pic/skills/tui2demo/SKILL.md"
"$SERVER" "$T/port3" "$T/log3" 240 "sse:$V/markdown.sse" "sse:$V/done.sse" "sse:$V/done.sse" "sse:$V/done.sse" "hang:$V/done.sse:461" \
    "sse:$V/markdown.sse" &
spid3=$!
bg "$spid3"
i=0
while [ ! -s "$T/port3" ]; do i=$((i + 1)); [ "$i" -lt 600 ] || fail "server 3"; sleep 0.05; done
printf '{"providers":{"fake":{"baseUrl":"http://127.0.0.1:%s","api":"anthropic-messages","apiKey":"$ANTHROPIC_API_KEY","models":[{"id":"m","contextWindow":200000},{"id":"q","contextWindow":200000},{"id":"r","contextWindow":200000}]}}}' \
    "$(cat "$T/port3")" > "$T/models3.json"
export PIC_MODELS_FILE="$T/models3.json" PIC_NO_NATIVE_CLIPBOARD=1
# A terminal that is known to draw no hyperlinks (Apple's Terminal), whatever the developer's own is.
unset TMUX STY TERM_PROGRAM_VERSION
export TERM=xterm-256color TERM_PROGRAM=Apple_Terminal
drive3() { # NAME [pic args]: the third journal and workspace
    name=$1
    shift
    "$DRIVE" "$T/$name.tx" 80 24 "$PIC" --tui-mode regular --db "$T/j3" --workspace "$T/ws3" --model fake/m "$@" ||
        fail "$name: $(perl -pe 's/\e\[[0-9;?]*[A-Za-z]//g; s/\r//g' "$T/$name.tx" | grep -v '^\s*$' | tail -8)"
}
pic3() { "$PIC" --db "$T/j3" --workspace "$T/ws3" "$@"; }

# The startup header lists the key hints and what was loaded; the terminal
# title names the directory. A reply renders as markdown: headings, italics,
# a link with its url, a numbered list, a quote, a table, a labelled fence;
# the user's message is on a background.
drive3 markdown <<'EOF2'
expect pic fake/m
expect esc interrupt · ctrl+c/ctrl+d clear/exit · / commands · ! bash · ctrl+o more
expect [Context]
expect AGENTS.md
expect [Skills]
expect tui2demo
expect [Prompts]
expect /greet
send show markdown\r
expect Heading
expect Some italic and bold with a link (https://example.com/page).
expect 1. first
expect 2. second
expect │ quoted words
expect │ apple
expect ┌
expect ```python
expect   print('hi')
wait 200
send \x04\x04
EOF2
grep -aq "$(printf '\033]0;pic - ws3\007')" "$T/markdown.tx" || fail "markdown: terminal title not set"
grep -aqE "$(printf '\033')\[48;(5;23|2;33;59;73)m" "$T/markdown.tx" || fail "markdown: the user message has no background"
grep -aq "$(printf '\033')\[3mitalic" "$T/markdown.tx" || fail "markdown: italic not styled"
printf 'PASS: the header lists keys and loaded resources, the title names the directory, a reply renders as markdown, the user message has a background\n'

# "!!cmd" runs in the workspace and stays out of the context; "!cmd" goes to
# the model in front of the next message; a failing command shows its exit
# code; Esc cancels a running one; one typed while a reply runs waits for it
# and then runs, with no pause after the reply. Alt+Up
# restores queued messages without stopping the reply.
printf 'in-workspace\n' > "$T/ws3/marker.txt"
drive3 bang tui -c <<'EOF2'
expect continuing
send !!cat marker.txt\r
expect $ cat marker.txt
expect in-workspace
wait 400
send ok\r
expect All done.
send !printf ctx-out\r
expect ctx-out
wait 400
send next\r
expect All done.
send !exit 3\r
expect (exit 3)
send burst\r
send !echo burst-ran\r
expect $ echo burst-ran
expect burst-ran
send !sleep 31\r
expect $ sleep 31
expect Running... (esc to cancel)
send \e
expect (cancelled)
send hold on\r
waitfile $T/log3/5.req
send !echo nope\r
expect Follow-up: !echo nope
send \x15
send queued one\r
expect Steering: queued one
expect up to edit queued messages
send \e[1;3A
expect Restored 2 queued messages to editor
expect > queued one
wait 200
send \e
expect Operation aborted
send \x03
send \x04\x04
EOF2
grep -q 'Ran `printf ctx-out`' "$T/log3/3.req" || fail "bang: ! output did not go with the next message"
! grep -q 'Ran `printf ctx-out`' "$T/log3/2.req" || fail "bang: ! output went early"
! grep -q 'cat marker.txt' "$T/log3"/*.req || fail "bang: !! output went to the model"
# The commands are journaled as Pi's bashExecution messages: in the log, the
# Pi export and the model's next request; Alt+Up made the child forget the steer.
pic3 log | grep -q 'bash \$ printf ctx-out' || fail "bang: the command is not in the log: $(pic3 log | tail -5)"
pic3 log --json | grep -qF '"bash":{"command":"exit 3","output":"","exitCode":3,' || fail "bang: no exit code in the journal"
pic3 log --json | grep -qF '"excludeFromContext":true' || fail "bang: no !! in the journal"
mkdir "$T/pi3"
pic3 export --pi "$T/pi3" > /dev/null || fail "bang: export --pi"
cat "$T"/pi3/* | grep -qF '"role":"bashExecution","command":"printf ctx-out"' || fail "bang: the Pi export lacks the command"
cat "$T"/pi3/* | grep -qF '"excludeFromContext":true' || fail "bang: the Pi export lacks the !! flag"
[ "$("$SQLITE3" "$T/j3" "SELECT state FROM pic_queued WHERE text = 'queued one'")" = cleared ] || fail "queue: Alt+Up left the steer queued in the child"
pic3 check > /dev/null || fail "bang: integrity"
printf 'PASS: !cmd goes to the model with the next message, !!cmd does not; exit codes, Esc, no commands during a reply, Alt+Up restores the queue\n'

# Editor keys: kill ring and yank, undo, the external editor, suspend; Esc
# Esc opens /tree; Shift+Ctrl+P cycles the models backwards; Ctrl+X copies.
printf 'printf "edited by script\\n" > "$1"\n' > "$T/ed.sh"
export VISUAL= EDITOR="sh $T/ed.sh"
pic3 scoped-models --set fake/m fake/q fake/r
drive3 editor tui -c <<'EOF2'
expect continuing
send one two
expect > one two
send \x15
wait 150
send \x19
expect > one two
send \x03
send alpha beta
expect > alpha beta
send \x1f
expect > alpha
send \x03
send draft
expect > draft
send \x07
expect Launching external editor
expect > edited by script
send \x03
send keep
expect > keep
send \x1a
wait 300
send x
expect > keepx
send \x03
send \x10
expect model fake/q
send \e[112;6u
expect model fake/m
send \e[112;6u
expect model fake/r
send \x18
expect Copied last agent message to clipboard
send \e
wait 100
send \e
expect Rewind
send \e
send \x04\x04
EOF2
unset VISUAL EDITOR
pic3 scoped-models --clear
[ "$(grep -ac "$(printf '\033')\[?2004h" "$T/editor.tx")" -ge 2 ] || fail "editor: the terminal was not set up again after Ctrl+Z"
grep -aq "$(printf '\033')\]52;c;" "$T/editor.tx" || fail "editor: no OSC 52 copy"
printf 'PASS: kill ring, undo, Ctrl+G, Ctrl+Z, Shift+Ctrl+P, Ctrl+X and Esc Esc work in the terminal\n'

# Links are OSC 8 hyperlinks on a terminal that draws them: the url is not printed.
export TERM_PROGRAM=ghostty
drive3 links <<'EOF2'
expect pic fake/m
send links please\r
expect Some italic and bold with a
wait 200
send \x04\x04
EOF2
grep -aqE "$(printf '\033')\]8;id=pic[0-9a-f]+;https://example.com/page" "$T/links.tx" || fail "links: no OSC 8 hyperlink"
printf 'PASS: links are OSC 8 hyperlinks where the terminal draws them\n'

# Pi parity, round 3: steering over the child's command pipe, live tool output,
# the retry countdown, queued messages handed back. A fourth server; connection
# order is test order:
#  1-2 live output   3-4 steer   5-7 follow-up   8 Alt+Up   9 Esc with a queue
#  10-11 retry countdown   12 Esc in the wait   13-15 a request that fails
mkdir "$T/log4" "$T/ws4"
H=$S/bash_hold.sse
"$SERVER" "$T/port4" "$T/log4" 300 "sse:$V/bash_live.sse" "sse:$V/done.sse" "sse:$H" "sse:$V/done.sse" "sse:$H" "sse:$V/done.sse" \
    "sse:$V/done.sse" "sse:$H" "sse:$H" "retry:503:3" "sse:$V/done.sse" "retry:503:30" "retry:503:1" &
spid4=$!
bg "$spid4"
i=0
while [ ! -s "$T/port4" ]; do i=$((i + 1)); [ "$i" -lt 600 ] || fail "server 4"; sleep 0.05; done
printf '{"providers":{"fake":{"baseUrl":"http://127.0.0.1:%s","api":"anthropic-messages","apiKey":"$ANTHROPIC_API_KEY","models":[{"id":"m","contextWindow":200000}]}}}' \
    "$(cat "$T/port4")" > "$T/models4.json"
export PIC_MODELS_FILE="$T/models4.json"
drive4() { # NAME [pic args]: the fourth journal and workspace
    name=$1
    shift
    "$DRIVE" "$T/$name.tx" 80 24 "$PIC" --tui-mode regular --db "$T/j4" --workspace "$T/ws4" --model fake/m "$@" ||
        fail "$name: $(perl -pe 's/\e\[[0-9;?]*[A-Za-z]//g; s/\r//g' "$T/$name.tx" | grep -v '^\s*$' | tail -8)"
}
pic4() { "$PIC" --db "$T/j4" --workspace "$T/ws4" "$@"; }

# A bash call's output is shown while it runs, not only when it ends.
touch_when "$T/live.tx" out-alpha "$T/ws4/live-release"
drive4 live <<'EOF2'
expect pic fake/m
send live\r
expect $ printf out-%s alpha
expect out-alpha
expect Elapsed
expect out-beta
expect Took
expect All done.
send \x04\x04
EOF2
wait "$rpid" 2>/dev/null || :
printf 'PASS: a running bash call shows its output as it arrives\n'

# Enter while a reply runs steers it: the message is shown as queued, then as a
# user message where it lands; the model sees it after the tool result.
rm -f "$T/ws4/release" "$T/ws4/started"
touch_when "$T/steer.tx" "Steering: steer this" "$T/ws4/release"
drive4 steer <<'EOF2'
expect pic fake/m
send go\r
expect $ touch started
send steer this\r
expect Steering: steer this
expect up to edit queued messages
expect All done.
send \x04\x04
EOF2
wait "$rpid" 2>/dev/null || :
grep -aqE "$(printf '\033')\[48;(5;23|2;33;59;73)m[^m]*m?[^m]*msteer this" "$T/steer.tx" || fail "steer: the delivered message is not shown as a user message"
grep -qF 'steer this' "$T/log4/4.req" || fail "steer: request 2 lacks the steer: $(tail -c 600 "$T/log4/4.req")"
! grep -qF 'steer this' "$T/log4/3.req" || fail "steer: sent with the first request"
[ "$(pic4 log | grep -c 'you: steer this')" = 1 ] || fail "steer: not in the journal once: $(pic4 log | tail -8)"
pic4 check > /dev/null || fail "steer: integrity"
printf 'PASS: Enter steers a running reply: queued as Steering, then shown as a user message and sent after the tool result\n'

# Alt+Enter (ESC CR) queues a follow-up that runs after the reply.
rm -f "$T/ws4/release" "$T/ws4/started"
touch_when "$T/follow.tx" "Follow-up: then this" "$T/ws4/release"
drive4 follow <<'EOF2'
expect pic fake/m
send go\r
expect $ touch started
send then this\e\r
expect Follow-up: then this
expect ↑55 ↓60
expect ↑85 ↓80
send \x04\x04
EOF2
wait "$rpid" 2>/dev/null || :
grep -qF 'then this' "$T/log4/7.req" || fail "follow-up: the third request lacks it: $(tail -c 500 "$T/log4/7.req")"
! grep -qF 'then this' "$T/log4/6.req" || fail "follow-up: delivered before the answer"
printf 'PASS: Alt+Enter queues a follow-up that runs after the answer\n'

# Alt+Up asks the child to forget its queue (clear_queue) and puts the text back; Esc aborts.
rm -f "$T/ws4/release" "$T/ws4/started"
drive4 dequeue <<'EOF2'
expect pic fake/m
send go\r
expect $ touch started
send to be restored\r
expect Steering: to be restored
send \e[1;3A
expect Restored 1 queued message to editor
expect > to be restored
send \e
expect Operation aborted
send \x03
send \x04\x04
EOF2
[ "$("$SQLITE3" "$T/j4" "SELECT state FROM pic_queued WHERE text = 'to be restored'")" = cleared ] || fail "dequeue: the child still holds the steer"
printf 'PASS: Alt+Up clears the child'"'"'s queue and restores it to the editor; Esc aborts over the pipe\n'

# Esc with messages queued: they come back to the editor, as Pi's restoreQueuedMessagesToEditor with abort.
rm -f "$T/ws4/release" "$T/ws4/started"
drive4 escq <<'EOF2'
expect pic fake/m
send go\r
expect $ touch started
send first queued\r
expect Steering: first queued
send \e
expect Operation aborted
expect > first queued
send \x03
send \x04\x04
EOF2
[ "$("$SQLITE3" "$T/j4" "SELECT state FROM pic_queued WHERE text = 'first queued'")" = cleared ] || fail "escq: the steer was not cleared"
pic4 check > /dev/null || fail "escq: integrity"
printf 'PASS: Esc on a running reply hands the queued messages back to the editor\n'

# A retry with a delay counts down; Esc during the wait cancels it.
drive4 retry <<'EOF2'
expect pic fake/m
send slow\r
expect Retrying (2/4) in 3s
expect (esc to cancel)
expect in 2s
expect All done.
send \x04\x04
EOF2
drive4 retrycancel <<'EOF2'
expect pic fake/m
send slower\r
expect Retrying (2/4) in 30s
expect in 29s
send \e
expect Operation aborted
send \x04\x04
EOF2
printf 'PASS: a retry delay counts down in the status line and Esc during it cancels the request\n'

# A request that fails hands back the follow-up it still held (a steer would have been delivered to it).
drive4 failq <<'EOF2'
expect pic fake/m
send doomed\r
expect Retrying (2/4) in 1s
send never ran\e\r
expect Follow-up: never ran
expect Retry failed after
expect > never ran
send \x15
send \x04\x04
EOF2
pic4 check > /dev/null || fail "failq: integrity"
printf 'PASS: a request that fails returns the queued follow-up to the editor\n'

# @file completion: "@" plus part of a path lists workspace files and folders; Tab accepts, a folder
# continues into it, a file ends with a space; Esc dismisses the menu; .git is not offered.
mkdir -p "$T/ws/docs/sub" "$T/ws/.git"
: > "$T/ws/docs/guide.md"
: > "$T/ws/.git/guide.cfg"
drive atfile <<'EOF2'
expect pic fake/m
send look @do
expect docs/
send \t
expect > look @docs/
send gu
expect guide.md
send \t
expect > look @docs/guide.md
send \x03
send @gu
expect guide.md
send \e
send \x03
send @docs/su
expect sub/
send \r
expect > @docs/sub/
send \x03
send \x04\x04
EOF2
printf 'PASS: @file completion lists workspace paths, Tab accepts, folders continue, Esc dismisses\n'

# .picignore hides zzh-hidden.md from completion; .fslignore does not hide zzh-fsl.md.
: > "$T/ws/zzh-hidden.md"
: > "$T/ws/zzh-shown.md"
: > "$T/ws/zzh-fsl.md"
printf 'zzh-hid*\n' > "$T/ws/.picignore"
printf 'zzh-fsl*\n' > "$T/ws/.fslignore"
drive atignore <<'EOF2'
expect pic fake/m
send @zzh
expect zzh-fsl.md
expect zzh-shown.md
send \x03
send \x04\x04
EOF2
if grep -q 'zzh-hidden' "$T/atignore.tx"; then fail "an ignored file was offered by @file completion"; fi
printf 'PASS: @file completion omits files named by .picignore, not .fslignore\n'