summaryrefslogtreecommitdiff
path: root/ui/ui.go
diff options
context:
space:
mode:
authordelthas <delthas@dille.cc>2022-07-25 10:56:57 +0200
committerdelthas <delthas@dille.cc>2022-07-25 10:56:57 +0200
commitf52114de33d3b51f298a3a7d1f6b59b3853d112c (patch)
tree8ef4b50bdd0b66d0a636e97a71f57757667aeb6a /ui/ui.go
parentFix crashing when shrinking the text to a zero width (diff)
Add pane-widths { text } to limit the max line width
Fixes: https://todo.sr.ht/~taiite/senpai/87
Diffstat (limited to 'ui/ui.go')
-rw-r--r--ui/ui.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/ui/ui.go b/ui/ui.go
index 5533633..7ae13e2 100644
--- a/ui/ui.go
+++ b/ui/ui.go
@@ -16,6 +16,7 @@ type Config struct {
ChanColEnabled bool
MemberColWidth int
MemberColEnabled bool
+ TextMaxWidth int
AutoComplete func(cursorIdx int, text []rune) []Completion
Mouse bool
MergeLine func(former *Line, addition Line)
@@ -404,10 +405,14 @@ func (ui *UI) Resize() {
innerWidth = 1 // will break display somewhat, but this is an edge case
}
ui.e.Resize(innerWidth)
+ textWidth := innerWidth
+ if ui.config.TextMaxWidth > 0 && ui.config.TextMaxWidth < textWidth {
+ textWidth = ui.config.TextMaxWidth
+ }
if ui.channelWidth == 0 {
- ui.bs.ResizeTimeline(innerWidth, h-3)
+ ui.bs.ResizeTimeline(innerWidth, h-3, textWidth)
} else {
- ui.bs.ResizeTimeline(innerWidth, h-2)
+ ui.bs.ResizeTimeline(innerWidth, h-2, textWidth)
}
ui.screen.Sync()
}