summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Mattern <rephorm@rephorm.com>2019-06-03 15:14:22 -0700
committerBrian Mattern <rephorm@rephorm.com>2019-06-03 15:14:22 -0700
commitbb44c222ef68b8b81bb0b8ec0322c2a47bc38db9 (patch)
tree7be6b467f6a6730c64e961208b7ae138990dfb40
parent2aea13bf0a89e9719d40e6ddb200b89982f18ebd (diff)
Add cursor while editing filter.
Also, change from [Filter: ...] to Filter: [...].
-rw-r--r--src/widgets/proc.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/widgets/proc.go b/src/widgets/proc.go
index fa1b900..688288b 100644
--- a/src/widgets/proc.go
+++ b/src/widgets/proc.go
@@ -22,6 +22,7 @@ const (
UP_ARROW = "▲"
DOWN_ARROW = "▼"
ELLIPSIS = "…"
+ CURSOR = " "
)
type ProcSortMethod string
@@ -126,9 +127,10 @@ func (self *ProcWidget) drawFilter(buf *tui.Buffer) {
style := self.TitleStyle
label := "Filter: "
if self.editingFilter {
- label = "[ Filter: "
+ label = "Filter: ["
style = tui.NewStyle(style.Fg, style.Bg, tui.ModifierBold)
}
+ cursorStyle := tui.NewStyle(style.Bg, style.Fg, tui.ModifierClear)
p := image.Pt(self.Min.X+2, self.Max.Y-1)
buf.SetString(label, style, p)
@@ -143,6 +145,8 @@ func (self *ProcWidget) drawFilter(buf *tui.Buffer) {
p.X += utf8.RuneCountInString(filter)
if self.editingFilter {
+ buf.SetString(CURSOR, cursorStyle, p)
+ p.X += 1
remaining := self.Max.X - 2 - p.X
buf.SetString(fmt.Sprintf("%*s", remaining, "]"), style, p)
}