From 65dfdbf77aa83b6ef34716f98216d425c4f30b4b Mon Sep 17 00:00:00 2001 From: Danny Tylman Date: Tue, 15 Mar 2016 11:42:42 +0200 Subject: [PATCH] Add support for masked views --- view.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/view.go b/view.go index 509f44f..6846a2f 100644 --- a/view.go +++ b/view.go @@ -60,6 +60,9 @@ type View struct { // If Frame is true, Title allows to configure a title for the view. Title string + + // If set and view is Editable, displays the mask instead of the real content + Mask rune } type viewLine struct { @@ -108,6 +111,10 @@ func (v *View) setRune(x, y int, ch rune) error { fgColor = v.FgColor bgColor = v.BgColor } + + if v.Mask != 0 { + ch = v.Mask + } termbox.SetCell(v.x0+x+1, v.y0+y+1, ch, termbox.Attribute(fgColor), termbox.Attribute(bgColor)) return nil