mirror of
https://github.com/mum4k/termdash.git
synced 2025-04-25 13:48:50 +08:00
Faketerm and diff on it supports partial cells.
Don't print out partial cells (cells that don't really exist since the previous cell contains a full-width rune).
This commit is contained in:
parent
367af3f86d
commit
9786171a7a
@ -56,12 +56,18 @@ func Diff(want, got *Terminal) string {
|
||||
var optDiffs []*optDiff
|
||||
for row := 0; row < size.Y; row++ {
|
||||
for col := 0; col < size.X; col++ {
|
||||
p := image.Point{col, row}
|
||||
partial, err := got.BackBuffer().IsPartial(p)
|
||||
if err != nil {
|
||||
panic(fmt.Errorf("unable to determine if point %v is a partial rune: %v", p, err))
|
||||
}
|
||||
|
||||
gotCell := got.BackBuffer()[col][row]
|
||||
wantCell := want.BackBuffer()[col][row]
|
||||
r := gotCell.Rune
|
||||
if r != wantCell.Rune {
|
||||
r = '࿃'
|
||||
} else if r == 0 {
|
||||
} else if r == 0 && !partial {
|
||||
r = ' '
|
||||
}
|
||||
b.WriteRune(r)
|
||||
|
@ -121,7 +121,12 @@ func (t *Terminal) String() string {
|
||||
for row := 0; row < size.Y; row++ {
|
||||
for col := 0; col < size.X; col++ {
|
||||
r := t.buffer[col][row].Rune
|
||||
if r == 0 {
|
||||
p := image.Point{col, row}
|
||||
partial, err := t.buffer.IsPartial(p)
|
||||
if err != nil {
|
||||
panic(fmt.Errorf("unable to determine if point %v is a partial rune: %v", p, err))
|
||||
}
|
||||
if r == 0 && !partial {
|
||||
r = ' '
|
||||
}
|
||||
b.WriteRune(r)
|
||||
|
Loading…
x
Reference in New Issue
Block a user