1
1
mirror of https://github.com/walles/moar.git synced 2025-01-08 14:30:57 +03:00

Render unprintable characters as highlighted '?'

This commit is contained in:
Johan Walles 2021-04-25 23:35:47 +02:00
parent 7bf168255a
commit 17d8a0372a

View File

@ -140,13 +140,20 @@ func cellsFromString(s string) []twin.Cell {
Style: styleBrokenUtf8,
})
case '\x08': // Backspace
case BACKSPACE:
cells = append(cells, twin.Cell{
Rune: '<',
Style: styleBrokenUtf8,
})
default:
if !unicode.IsPrint(token.Rune) {
cells = append(cells, twin.Cell{
Rune: '?',
Style: styleBrokenUtf8,
})
continue
}
cells = append(cells, token)
}
}