[GH-ISSUE #200] faketerm.Diff doesn't seem to correctly handle partial cells #114

Open
opened 2026-03-03 16:22:29 +03:00 by kerem · 0 comments
Owner

Originally created by @mum4k on GitHub (May 4, 2019).
Original GitHub issue: https://github.com/mum4k/termdash/issues/200

This only has impact on the readability of test outputs.

Partial cells are cells in the buffer that should not contain a rune, because the previous cell contains a full-width unicode rune. Full-width unicode runes that two cells when printed on the terminal.

The partial cell is printed out even though it should be skipped:

               got:
                    │         ⢀⠎
                    │        ⡠⠃
                    │       ⡔⠁
            世^@世^@世^@世^@│     ⢀⠎
                    │    ⡰⠁
                    │  ⢀⠜
                    │ ⢠⠊
                 abc│⡰⠁
                    └───────────
                     0         1

The bug seems to be here, we print out the rune even if it is is partial:
github.com/mum4k/termdash@07850c79a8/internal/faketerm/diff.go (L72-L75)

And here:
github.com/mum4k/termdash@07850c79a8/internal/faketerm/faketerm.go (L130-L133)

Originally created by @mum4k on GitHub (May 4, 2019). Original GitHub issue: https://github.com/mum4k/termdash/issues/200 This only has impact on the readability of test outputs. Partial cells are cells in the buffer that should not contain a rune, because the previous cell contains a full-width unicode rune. Full-width unicode runes that two cells when printed on the terminal. The partial cell is printed out even though it should be skipped: ``` got: │ ⢀⠎ │ ⡠⠃ │ ⡔⠁ 世^@世^@世^@世^@│ ⢀⠎ │ ⡰⠁ │ ⢀⠜ │ ⢠⠊ abc│⡰⠁ └─────────── 0 1 ``` The bug seems to be here, we print out the rune even if it is is partial: https://github.com/mum4k/termdash/blob/07850c79a8a1c48a1c0822c156b6e226ff94c3c7/internal/faketerm/diff.go#L72-L75 And here: https://github.com/mum4k/termdash/blob/07850c79a8a1c48a1c0822c156b6e226ff94c3c7/internal/faketerm/faketerm.go#L130-L133
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/termdash#114
No description provided.