blob: 49d90bdd99e1e4f8dd9708c710ffc4b26ac1c543 (
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
|
# Invalid UTF-8 must RENDER, never panic. Two sources, both ordinary use:
# a file pane holds whatever bytes are on disk (latin-1, a truncated sequence,
# an ELF opened by mistake), and the byte-column hscroll cuts a multi-byte
# glyph in half by design. Undecodable bytes come out as U+FFFD, one per byte.
file bad.txt hello \xff\xfe world\nlatin-1 caf\xe9 tail\ntruncated \xe6\x97 here\nend\n
file wide.txt \xe6\x97\xa5\xe6\x9c\xac\xe8\xaa\x9e \xe6\x97\xa5\xe6\x9c\xac\xe8\xaa\x9e \xe6\x97\xa5\xe6\x9c\xac\xe8\xaa\x9e \xe6\x97\xa5\xe6\x9c\xac\xe8\xaa\x9e \xe6\x97\xa5\xe6\x9c\xac\xe8\xaa\x9e \xe6\x97\xa5\xe6\x9c\xac\xe8\xaa\x9e \xe6\x97\xa5\xe6\x9c\xac\xe8\xaa\x9e tail\nsecond line\n
start 30 100 bad.txt
wait 8000 New Newcol
stable 700 20000
snap badbytes
# 50 columns, not 100: a FILE boots alone and fills the window, and at 100 the
# whole line fits, so `$` scrolls nowhere and there is no glyph to cut. This is
# the width the left column used to be, i.e. the pane this case was written for
start 30 50 wide.txt
wait 8000 New Newcol
stable 700 20000
# SPC t w turns soft wrap OFF: hscroll is the other half of this case and a
# wrapped body has nothing to scroll sideways, so the byte cut that halves a
# glyph only exists here. (The WRAP cut halves one too — same bytes, same
# U+FFFD — and wrap.snap pins that one.)
key space t w
stable 400 5000
key $
stable 700 10000
snap hscroll-midglyph
|