diff options
author | delthas <delthas@dille.cc> | 2022-07-25 10:56:57 +0200 |
---|---|---|
committer | delthas <delthas@dille.cc> | 2022-07-25 10:56:57 +0200 |
commit | f52114de33d3b51f298a3a7d1f6b59b3853d112c (patch) | |
tree | 8ef4b50bdd0b66d0a636e97a71f57757667aeb6a /config.go | |
parent | Fix 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 '')
-rw-r--r-- | config.go | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -68,6 +68,7 @@ type Config struct { ChanColEnabled bool MemberColWidth int MemberColEnabled bool + TextMaxWidth int Colors ConfigColors @@ -100,6 +101,7 @@ func Defaults() (cfg Config, err error) { ChanColEnabled: true, MemberColWidth: 16, MemberColEnabled: true, + TextMaxWidth: 0, Colors: ConfigColors{ Prompt: tcell.ColorDefault, Unread: tcell.ColorDefault, @@ -241,6 +243,15 @@ func unmarshal(filename string, cfg *Config) (err error) { } else { cfg.MemberColWidth = members } + case "text": + var text string + if err := child.ParseParams(&text); err != nil { + return err + } + + if cfg.TextMaxWidth, err = strconv.Atoi(text); err != nil { + return err + } default: return fmt.Errorf("unknown directive %q", child.Name) } |