about summary refs log tree commit diff stats
path: root/widgets
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2019-05-11 13:20:29 -0400
committerDrew DeVault <sir@cmpwn.com>2019-05-11 13:20:29 -0400
commit72e4b5e2b2e0de50b8572f195f73ccdd8e9d9461 (patch)
tree4d20a22bf099f2a3e3d8bd294fa84c6900945784 /widgets
parent8fa458323058c8998408f88b80d07c687fccd521 (diff)
downloadaerc-72e4b5e2b2e0de50b8572f195f73ccdd8e9d9461.tar.gz
Refactor ctx stashing out of exline
Diffstat (limited to 'widgets')
-rw-r--r--widgets/exline.go10
1 files changed, 2 insertions, 8 deletions
diff --git a/widgets/exline.go b/widgets/exline.go
index c841802..a5b896f 100644
--- a/widgets/exline.go
+++ b/widgets/exline.go
@@ -10,7 +10,6 @@ type ExLine struct {
 	ui.Invalidatable
 	cancel func()
 	commit func(cmd string)
-	ctx    *ui.Context
 	input  *ui.TextInput
 }
 
@@ -32,7 +31,6 @@ func (ex *ExLine) Invalidate() {
 }
 
 func (ex *ExLine) Draw(ctx *ui.Context) {
-	ex.ctx = ctx // gross
 	ex.input.Draw(ctx)
 }
 
@@ -45,14 +43,10 @@ func (ex *ExLine) Event(event tcell.Event) bool {
 	case *tcell.EventKey:
 		switch event.Key() {
 		case tcell.KeyEnter:
-			if ex.ctx != nil {
-				ex.ctx.HideCursor()
-			}
+			ex.input.Focus(false)
 			ex.commit(ex.input.String())
 		case tcell.KeyEsc, tcell.KeyCtrlC:
-			if ex.ctx != nil {
-				ex.ctx.HideCursor()
-			}
+			ex.input.Focus(false)
 			ex.cancel()
 		default:
 			return ex.input.Event(event)