summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorcitrons <citrons@mondecitronne.com>2025-06-05 19:42:46 -0500
committercitrons <citrons@mondecitronne.com>2025-06-07 16:02:18 -0500
commit0f1c3ef1871f311d79f8274585bdb2925152f576 (patch)
treeb1b281eebc8dd2a8f07ddaad698515cfbe25b517 /client
parent2d54af98b89d5f7ff43bc0d887e42bde7ef87dbc (diff)
limit size of command window preview
Diffstat (limited to 'client')
-rw-r--r--client/cmd_window.go8
-rw-r--r--client/main.go10
-rw-r--r--client/ui.go7
3 files changed, 17 insertions, 8 deletions
diff --git a/client/cmd_window.go b/client/cmd_window.go
index e8dcaed..0a76e25 100644
--- a/client/cmd_window.go
+++ b/client/cmd_window.go
@@ -86,9 +86,11 @@ func (w *cmdWindow) showPreview() {
Width: tui.Fill, Height: tui.Children,
})
+ var isOverflow bool
tui.Push(msg.Id(), tui.Box {
Width: tui.Fill, Height: tui.Children,
Style: &tui.Style {Fg: tui.White, Bg: colorDefault[bottom.IsOdd()]},
+ Overflow: true, MaxHeight: 7, IsOverflow: &isOverflow,
})
msg.Show(bottom.IsOdd())
tui.Pop()
@@ -98,6 +100,12 @@ func (w *cmdWindow) showPreview() {
Style: &tui.Style {Bg: tui.White, Fg: tui.Black},
})
+ if isOverflow {
+ tui.Push("", tui.Box {Width: tui.TextSize, Height: 1, NoWrap: true})
+ tui.Text("[MORE]", nil)
+ tui.Pop()
+ }
+
tui.Push("", tui.Box {Width: tui.Fill, Height: 1})
tui.Pop()
diff --git a/client/main.go b/client/main.go
index c9da6c3..5993cf6 100644
--- a/client/main.go
+++ b/client/main.go
@@ -39,7 +39,15 @@ func main() {
redraw = true
case <-drawTick:
if redraw {
- globalApp.show()
+ for i := 0; i < 2; i++ {
+ // some information takes two passes to propogate
+ tui.Clear()
+ globalApp.show()
+ tui.DrawLayout()
+ }
+ if tui.Present() != nil {
+ os.Exit(-1)
+ }
redraw = false
}
case text := <-globalApp.activePaste:
diff --git a/client/ui.go b/client/ui.go
index a6b6924..50e7790 100644
--- a/client/ui.go
+++ b/client/ui.go
@@ -7,7 +7,6 @@ import (
"citrons.xyz/talk/proto"
"zgo.at/termfo/keys"
"strings"
- "os"
)
func (a *application) getWin() window.Window {
@@ -189,7 +188,6 @@ func (a *application) showWindow() {
}
func (a *application) show() {
- tui.Clear()
s := tui.Size()
tui.Push("", tui.Box {
Width: tui.BoxSize(s.Width), Height: tui.BoxSize(s.Height),
@@ -201,9 +199,4 @@ func (a *application) show() {
tui.Text(strings.Repeat("│", s.Height), nil)
tui.Pop()
a.showWindow()
-
- tui.DrawLayout()
- if tui.Present() != nil {
- os.Exit(-1)
- }
} \ No newline at end of file