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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
# RANGED LOOK PATHS. `path:LINE:COL` says where to PARK; a range says what to
# SELECT, and it belongs to the PATH (config.range_sep) rather than to the
# search that is merely the first thing writing one. So this script right-
# clicks the three spellings as ordinary words sitting in a file:
# r.txt:3-5 whole lines 3 through 5
# r.txt:7:4-9 line 7, columns 4 through 9
# r.txt:3:2-5:3 line 3 column 2 through line 5 column 3
# ...and only then presses `/`, whose result rows are exactly this syntax —
# which is how n/N select a hit and Enter lands on it with the matched text
# selected.
#
# `snapstyle` is the assertion that matters: the grid TEXT after a ranged look
# is the same text a plain `:LINE:COL` look leaves, so the selection only shows
# in the styles.
file r.txt aaaa\nbbbb\ncccc dccc\ndddd\neeee\nffff\ngg NEEDLE gg\nhhhh NEEDLE\niiii
file look.txt r.txt:3-5\nr.txt:7:4-9\nr.txt:3:2-5:3\nr.txt:8:6-99:9
# Builtins announce themselves by default, and an announcement is a band at
# the top of the body -- which moves every row this script clicks. What the
# verbs do is what is under test, not the announcement.
config Verbose off
start 31 150 look.txt
wait 8000 r.txt:3-5
stable 700 20000
snap opened
# --- form 1: whole lines. r.txt opens BELOW look.txt (an ordinary look) with
# lines 3, 4 and 5 selected whole, terminators included — helix's own `x`.
press right 10 4
release right 10 4
wait 10000 cccc dccc
stable 700 15000
snap wholelines
snapstyle wholelines
# --- form 2: one line, a column span. r.txt is open now, so this re-uses that
# pane (focusPaneByPath) — the same route a `/` result row takes.
press right 12 5
release right 12 5
stable 700 15000
snap onelinespan
snapstyle onelinespan
# --- form 3: the general one, across both lines and columns
press right 12 6
release right 12 6
stable 700 15000
snap fullspan
snapstyle fullspan
# --- a STALE range: line 99 of a nine-line file, which is what a result row
# looks like once the file has changed underneath it. It must CLAMP — no crash,
# no garbage highlight — landing on the last cell that really exists.
press right 12 7
release right 12 7
stable 700 15000
snap stale
snapstyle stale
# --- and now the first consumer. The look above left r.txt focused, so `/`
# arms on it: the rows it writes carry the match's span, and the submit goes
# straight to the first of them — with the word itself selected, which is the
# whole reason the row spells a range and not a position.
key /
text NEEDLE
key enter
# Locations stack the target under its line now: two rows, two waits.
wait 10000 r.txt:7:4-9
wait 10000 gg NEEDLE gg
stable 700 15000
snap hit1
snapstyle hit1
# n selects the next row, and the Enter after it goes to that hit
key n
key enter
stable 700 15000
snap hit2
snapstyle hit2
# N walks back onto the first hit; Enter looks it, still selected
key N
key enter
stable 700 15000
snap back
snapstyle back
|