Sanitize terminal widget text
This commit is contained in:
committed by
Brandon McGinty
parent
8348a7083d
commit
770635955a
@@ -1,5 +1,16 @@
|
||||
package uiterm
|
||||
|
||||
import "unicode"
|
||||
|
||||
// safeRune prevents text supplied by a server or another user from being
|
||||
// interpreted as a terminal control sequence when termbox flushes its cells.
|
||||
func safeRune(r rune) rune {
|
||||
if unicode.IsControl(r) || unicode.Is(unicode.Bidi_Control, r) {
|
||||
return ' '
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
||||
type View interface {
|
||||
uiInitialize(ui *Ui)
|
||||
uiSetActive(active bool)
|
||||
|
||||
Reference in New Issue
Block a user