summary refs log tree commit diff stats
path: root/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'widgets')
-rw-r--r--widgets/compose.go17
-rw-r--r--widgets/terminal.go3
2 files changed, 19 insertions, 1 deletions
diff --git a/widgets/compose.go b/widgets/compose.go
index 10d14f7..f07e3ee 100644
--- a/widgets/compose.go
+++ b/widgets/compose.go
@@ -67,7 +67,7 @@ func NewComposer() *Composer {
 		grid:   grid,
 		editor: term,
 		// You have to backtab to get to "From", since you usually don't edit it
-		focused: 3,
+		focused: 1,
 		focusable: []ui.DrawableInteractive{
 			from,
 			to,
@@ -99,6 +99,21 @@ func (c *Composer) Focus(focus bool) {
 	c.focusable[c.focused].Focus(focus)
 }
 
+func (c *Composer) PrevField() {
+	c.focusable[c.focused].Focus(false)
+	c.focused--
+	if c.focused == -1 {
+		c.focused = len(c.focusable) - 1
+	}
+	c.focusable[c.focused].Focus(true)
+}
+
+func (c *Composer) NextField() {
+	c.focusable[c.focused].Focus(false)
+	c.focused = (c.focused + 1) % len(c.focusable)
+	c.focusable[c.focused].Focus(true)
+}
+
 func newHeaderEditor(name string, value string) *headerEditor {
 	return &headerEditor{
 		input: ui.NewTextInput(value),
diff --git a/widgets/terminal.go b/widgets/terminal.go
index 92736d5..ee99b60 100644
--- a/widgets/terminal.go
+++ b/widgets/terminal.go
@@ -273,6 +273,8 @@ func (term *Terminal) Draw(ctx *ui.Context) {
 		if ctx.Width() != cols || ctx.Height() != rows {
 			pty.Setsize(term.pty, &winsize)
 			term.vterm.SetSize(ctx.Height(), ctx.Width())
+			rect := vterm.NewRect(0, ctx.Width(), 0, ctx.Height())
+			term.damage = append(term.damage, *rect)
 			return
 		}
 	}
@@ -333,6 +335,7 @@ func (term *Terminal) Focus(focus bool) {
 			state := term.vterm.ObtainState()
 			row, col := state.GetCursorPos()
 			term.ctx.SetCursor(col, row)
+			term.Invalidate()
 		}
 	}
 }