diff --git a/go.mod b/go.mod index 8a857bd..73b9163 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,7 @@ require ( github.com/alecthomas/chroma/v2 v2.23.1 github.com/andybalholm/brotli v1.2.0 github.com/ayn2op/clipboard v0.0.0-20260308203959-c5ad7df3fc97 - github.com/ayn2op/tview v0.0.0-20260315070900-cf84a0d532d9 + github.com/ayn2op/tview v0.0.0-20260315074416-50a7d9c11304 github.com/deckarep/gosx-notifier v0.0.0-20180201035817-e127226297fb github.com/diamondburned/arikawa/v3 v3.6.1-0.20260311205148-176ad9b9440f github.com/diamondburned/ningen/v3 v3.0.1-0.20260306213430-5a08d3a709b4 diff --git a/go.sum b/go.sum index f6c8073..06e069b 100644 --- a/go.sum +++ b/go.sum @@ -16,8 +16,8 @@ github.com/andybalholm/brotli v1.2.0 h1:ukwgCxwYrmACq68yiUqwIWnGY0cTPox/M94sVwTo github.com/andybalholm/brotli v1.2.0/go.mod h1:rzTDkvFWvIrjDXZHkuS16NPggd91W3kUSvPlQ1pLaKY= github.com/ayn2op/clipboard v0.0.0-20260308203959-c5ad7df3fc97 h1:WujETUV+v0DEJyZgjeLzQvihWyL80c0Tg4qf0dDo+Io= github.com/ayn2op/clipboard v0.0.0-20260308203959-c5ad7df3fc97/go.mod h1:3kFnpNCa3dF6WryzOMCDao7PfZ7DTCh+pievlfuwV80= -github.com/ayn2op/tview v0.0.0-20260315070900-cf84a0d532d9 h1:XcMapeKrJg1SySKwxKJIdDlzTCH2KeHBTxFR+PwT7A8= -github.com/ayn2op/tview v0.0.0-20260315070900-cf84a0d532d9/go.mod h1:IXZrCv1VAZyWPdKDUJYs9ZYFiJ1GmCQUo9tLjQWoSnU= +github.com/ayn2op/tview v0.0.0-20260315074416-50a7d9c11304 h1:IbClNDuGoPrJtP4WkKr/iLXIxsR1WKSSJH46wLM0azM= +github.com/ayn2op/tview v0.0.0-20260315074416-50a7d9c11304/go.mod h1:IXZrCv1VAZyWPdKDUJYs9ZYFiJ1GmCQUo9tLjQWoSnU= github.com/danieljoos/wincred v1.2.3 h1:v7dZC2x32Ut3nEfRH+vhoZGvN72+dQ/snVXo/vMFLdQ= github.com/danieljoos/wincred v1.2.3/go.mod h1:6qqX0WNrS4RzPZ1tnroDzq9kY3fu1KwE7MRLQK4X0bs= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= diff --git a/internal/ui/chat/keybinds.go b/internal/ui/chat/keybinds.go index 3049db3..e0ea8e1 100644 --- a/internal/ui/chat/keybinds.go +++ b/internal/ui/chat/keybinds.go @@ -34,7 +34,7 @@ func (v *Model) activeKeyMap() help.KeyMap { return nil } - switch v.app.GetFocus() { + switch v.app.Focused() { case v.guildsTree: return v.guildsTree case v.messagesList: diff --git a/internal/ui/chat/message_input.go b/internal/ui/chat/message_input.go index 9e9df1a..fdb71c2 100644 --- a/internal/ui/chat/message_input.go +++ b/internal/ui/chat/message_input.go @@ -536,9 +536,9 @@ func (mi *messageInput) showMentionList() { borders = 1 } l := mi.mentionsList - x, _, _, _ := mi.GetInnerRect() - _, y, _, _ := mi.GetRect() - _, _, maxW, maxH := mi.chat.messagesList.GetInnerRect() + x, _, _, _ := mi.InnerRect() + _, y, _, _ := mi.Rect() + _, _, maxW, maxH := mi.chat.messagesList.InnerRect() if t := int(mi.cfg.Theme.MentionsList.MaxHeight); t != 0 { maxH = min(maxH, t) } diff --git a/internal/ui/chat/messages_list.go b/internal/ui/chat/messages_list.go index 87e9b8a..37de56f 100644 --- a/internal/ui/chat/messages_list.go +++ b/internal/ui/chat/messages_list.go @@ -215,7 +215,7 @@ func (ml *messagesList) drawDateSeparator(builder *tview.LineBuilder, ts discord label := " " + date + " " fillChar := ml.cfg.DateSeparator.Character dimStyle := baseStyle.Dim(true) - _, _, width, _ := ml.GetInnerRect() + _, _, width, _ := ml.InnerRect() if width <= 0 { builder.Write(strings.Repeat(fillChar, 8)+label+strings.Repeat(fillChar, 8), dimStyle) return @@ -513,7 +513,7 @@ func (ml *messagesList) drawEmbeds(builder *tview.LineBuilder, message discord.M defaultBarStyle := baseStyle.Dim(true) prefixText := " ▎ " prefixWidth := tview.TaggedStringWidth(prefixText) - _, _, innerWidth, _ := ml.GetInnerRect() + _, _, innerWidth, _ := ml.InnerRect() // Wrap against the current list viewport. This keeps embed wrapping stable even when sidebars/panes are resized. wrapWidth := max(innerWidth-prefixWidth, 1) diff --git a/internal/ui/chat/model.go b/internal/ui/chat/model.go index 6795d38..fe8e4c2 100644 --- a/internal/ui/chat/model.go +++ b/internal/ui/chat/model.go @@ -168,7 +168,7 @@ func (v *Model) focusMessageInput() bool { } func (v *Model) focusPrevious() { - switch v.app.GetFocus() { + switch v.app.Focused() { case v.messagesList: // Handle both a.messagesList and a.flex as well as other edge cases (if there is). if v.focusGuildsTree() { return @@ -185,7 +185,7 @@ func (v *Model) focusPrevious() { } func (v *Model) focusNext() { - switch v.app.GetFocus() { + switch v.app.Focused() { case v.messagesList: if v.focusMessageInput() { return @@ -268,7 +268,7 @@ func (v *Model) HandleEvent(event tcell.Event) tview.Command { } func (v *Model) showConfirmModal(prompt string, buttons []string, onDone func(label string)) { - v.confirmModalPreviousFocus = v.app.GetFocus() + v.confirmModalPreviousFocus = v.app.Focused() v.confirmModalDone = onDone modal := tview.NewModal(). diff --git a/internal/ui/login/qr/model.go b/internal/ui/login/qr/model.go index a3a9aae..0e3d7d3 100644 --- a/internal/ui/login/qr/model.go +++ b/internal/ui/login/qr/model.go @@ -146,7 +146,7 @@ func (m *Model) Draw(screen tcell.Screen) { } func (m *Model) centerLines(lines []tview.Line) []tview.Line { - _, _, _, height := m.GetInnerRect() + _, _, _, height := m.InnerRect() if height == 0 { height = 40 } diff --git a/internal/ui/root/model.go b/internal/ui/root/model.go index 3598dda..87231e3 100644 --- a/internal/ui/root/model.go +++ b/internal/ui/root/model.go @@ -143,8 +143,8 @@ func (m *Model) updateHelpHeight() { m.rootFlex.ResizeItem(m.help, height, 0) } -func (m *Model) GetRect() (int, int, int, int) { - return m.rootFlex.GetRect() +func (m *Model) Rect() (int, int, int, int) { + return m.rootFlex.Rect() } func (m *Model) SetRect(x int, y int, width int, height int) {