summaryrefslogtreecommitdiff
path: root/config.go
diff options
context:
space:
mode:
authordelthas <delthas@dille.cc>2022-04-20 15:05:14 +0200
committerdelthas <delthas@dille.cc>2022-04-20 15:05:14 +0200
commitdb5a4b730f72a66c60074a0854f64f05c1bf6c1d (patch)
tree9a0512af8f98ff2d35d1cff7dac8e3a21bf2fdd7 /config.go
parentDelete word on Alt+Backspace (diff)
Show/hide the channel & member list with F7/F8
This patch is inspired and modified from a patch by mooff. Also this switches the default configuration to *display* the channel & member list by default.
Diffstat (limited to 'config.go')
-rw-r--r--config.go68
1 files changed, 41 insertions, 27 deletions
diff --git a/config.go b/config.go
index 35857ba..c537623 100644
--- a/config.go
+++ b/config.go
@@ -62,11 +62,13 @@ type Config struct {
Typings bool
Mouse bool
- Highlights []string
- OnHighlightPath string
- NickColWidth int
- ChanColWidth int
- MemberColWidth int
+ Highlights []string
+ OnHighlightPath string
+ NickColWidth int
+ ChanColWidth int
+ ChanColEnabled bool
+ MemberColWidth int
+ MemberColEnabled bool
Colors ConfigColors
@@ -83,20 +85,22 @@ func DefaultHighlightPath() (string, error) {
func Defaults() (cfg Config, err error) {
cfg = Config{
- Addr: "",
- Nick: "",
- Real: "",
- User: "",
- Password: nil,
- TLS: true,
- Channels: nil,
- Typings: true,
- Mouse: true,
- Highlights: nil,
- OnHighlightPath: "",
- NickColWidth: 16,
- ChanColWidth: 0,
- MemberColWidth: 0,
+ Addr: "",
+ Nick: "",
+ Real: "",
+ User: "",
+ Password: nil,
+ TLS: true,
+ Channels: nil,
+ Typings: true,
+ Mouse: true,
+ Highlights: nil,
+ OnHighlightPath: "",
+ NickColWidth: 14,
+ ChanColWidth: 16,
+ ChanColEnabled: true,
+ MemberColWidth: 16,
+ MemberColEnabled: true,
Colors: ConfigColors{
Prompt: Color(tcell.ColorDefault),
},
@@ -204,23 +208,33 @@ func unmarshal(filename string, cfg *Config) (err error) {
return err
}
case "channels":
- var channels string
- if err := child.ParseParams(&channels); err != nil {
+ var channelsStr string
+ if err := child.ParseParams(&channelsStr); err != nil {
return err
}
-
- if cfg.ChanColWidth, err = strconv.Atoi(channels); err != nil {
+ channels, err := strconv.Atoi(channelsStr)
+ if err != nil {
return err
}
+ if channels == 0 {
+ cfg.ChanColEnabled = false
+ } else {
+ cfg.ChanColWidth = channels
+ }
case "members":
- var members string
- if err := child.ParseParams(&members); err != nil {
+ var membersStr string
+ if err := child.ParseParams(&membersStr); err != nil {
return err
}
-
- if cfg.MemberColWidth, err = strconv.Atoi(members); err != nil {
+ members, err := strconv.Atoi(membersStr)
+ if err != nil {
return err
}
+ if members == 0 {
+ cfg.MemberColEnabled = false
+ } else {
+ cfg.MemberColWidth = members
+ }
default:
return fmt.Errorf("unknown directive %q", child.Name)
}