blob: 33f8b01cfa490fdec8a07f38b3b1016d153f8837 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# The acme INVERSION, end to end: while a script holds a pane's `event` file
# open, a middle click in that pane is REPORTED to the script instead of being
# executed by the editor. That is how an acme client defines its own commands —
# `Step`, `Run`, `Clear` in examples/acmefs/life.py — and it is the one piece of
# this filesystem that changes what a click MEANS.
#
# The clicked word is `Newcol`, a real pardes builtin, so the two halves of the
# test cannot be confused with each other: with a reader attached the screen
# must not change and the record must arrive; with the reader gone the same
# click must open a column. It sits on the +New pane's first body line — row 5,
# and the line-number gutter is 7 cells wide, so the word starts at column 8.
run sh -c 'fusermount3 -u -z /tmp/pardes-acmefs-ev 2>/dev/null; rm -rf /tmp/pardes-acmefs-ev; exit 0'
start 30 100 --fs=/tmp/pardes-acmefs-ev
wait 8000 New Newcol
stable 700 20000
run sh -c 'M=/tmp/pardes-acmefs-ev; id=$(cut -c1-11 < $M/new/ctl | tr -d " "); echo $id > id.txt; printf "Newcol\n" >> $M/$id/body'
wait 8000 New Newcol
stable 700 15000
# a reader arrives: from here on, buttons 2 and 3 in this pane are its business
run sh -c 'M=/tmp/pardes-acmefs-ev; id=$(cat id.txt); (cat $M/$id/event > events.txt & echo $! > cat.pid); sleep 1'
press middle 9 5
release middle 9 5
stable 700 15000
# The screen must be UNCHANGED: no column opened, because the click belonged to
# the reader. An editor that had performed it would have split the layout.
snap after-suppressed-click
# The reader's death is asynchronous: the kernel sends RELEASE when the process
# closes, and pardes drains filesystem requests in its frame poll, AFTER input.
# A click delivered in the same wakeup as that RELEASE is therefore still the
# reader's. One second of sleep is more than the frame this takes.
run sh -c 'sleep 1; kill $(cat cat.pid) 2>/dev/null; sleep 1; sed -e "s/$/|/" events.txt > ev.txt; exit 0'
snapfile events ev.txt
# ...and with the reader gone, the same click is an ordinary Exec again: this
# one opens the column.
press middle 9 5
release middle 9 5
stable 700 15000
snap after-unsuppressed-click
run sh -c 'fusermount3 -u -z /tmp/pardes-acmefs-ev 2>/dev/null; rm -rf /tmp/pardes-acmefs-ev; exit 0'
|