diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-30 16:55:58 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 00:12:17 -0300 |
| commit | 257936b5803b5660428f29fdf4bae620f83b4018 (patch) | |
| tree | 782f0adbc82b0a95b8e6059d731ca1441fb158ce /test | |
| parent | 6122159572f1cc950666df484e2074cf32f22eb5 (diff) | |
| download | pardes-257936b5803b5660428f29fdf4bae620f83b4018.tar.gz pardes-257936b5803b5660428f29fdf4bae620f83b4018.zip | |
diff -u in a command pane names its files though the terminal turned the tab before each timestamp into blanks
A `---`/`+++` path was cut at the tab before diff -u's timestamp. Run in
a command pane, the terminal had turned that tab into blanks, so the name
took the timestamp with it and a look at a changed line opened nothing.
The name is now also cut where blanks run up to a timestamp, either GNU
diff's `2026-09-30 10:00:00...` or ctime's `Wed Sep 30 10:00:00 2026`. One
blank is enough, since a tab can expand to a single blank, and the stamp
is strict, so a name with blanks and no stamp after them stays whole.
Tested on the parsed text and, in fs.py, on real `diff -u` output in a
command pane, where a look at `+TWO` opens the new file.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'test')
| -rw-r--r-- | test/fs.py | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -381,6 +381,25 @@ def discovery(binary, embedded=False): # Through a mount both read as EINVAL; the log says which and why. assert f'err {scratch} addr: no match for regexp\n'.encode() in client.read('/log') client.remove(f'/pane/{scratch}') + # Real `diff -u` in a command pane: the terminal turns the tab + # before each timestamp into blanks, and a look at a changed line + # still opens the new file at it. + (root / 'diff-old.txt').write_text('one\ntwo\nthree\n') + (root / 'diff-new.txt').write_text('one\nTWO\nthree\n') + seen = client.read('/log').decode().count('\nexit ') + client.write('/exec', b'diff -u diff-old.txt diff-new.txt\n') + deadline = time.monotonic() + 10 + while client.read('/log').decode().count('\nexit ') <= seen: + assert time.monotonic() < deadline, 'diff -u never ended' + time.sleep(.05) + ran = [row.split()[0] for row in client.read('/index').decode().splitlines() if row.split()[1] == 'term'] + shown = client.read(f'/pane/{ran[-1]}/body').decode() + assert '+++ diff-new.txt' in shown and '\t' not in shown, shown + client.write(f'/pane/{ran[-1]}/look', b'+TWO\n') + opened = [row for row in client.read('/index').decode().splitlines() if row.split()[3] == f'{root}/diff-new.txt'] + assert len(opened) == 1, client.read('/index') + client.remove(f'/pane/{opened[0].split()[0]}') + client.remove(f'/pane/{ran[-1]}') # A Save makes the directories its file goes in, whatever names # it: the pane's own name or Save's path. # `~` is home (this session's HOME, the test's root) wherever a |
