diff options
| author | Hubert Hirtz <hubert@hirtz.pm> | 2020-11-07 11:41:19 +0100 |
|---|---|---|
| committer | Hubert Hirtz <hubert@hirtz.pm> | 2020-11-07 11:41:19 +0100 |
| commit | 27060a93cafc28e47929e776d54a64725f7b8b03 (patch) | |
| tree | e0c0fbe0a632dcb1d02540ce76d206066cc3f817 | |
| parent | Default user/real to nickname if unspecified (diff) | |
Configurable channel list width
| -rw-r--r-- | app.go | 1 | ||||
| -rw-r--r-- | config.go | 4 | ||||
| -rw-r--r-- | ui/ui.go | 17 |
3 files changed, 14 insertions, 8 deletions
@@ -37,6 +37,7 @@ func NewApp(cfg Config) (app *App, err error) { app.win, err = ui.New(ui.Config{ NickColWidth: cfg.NickColWidth, + ChanColWidth: cfg.ChanColWidth, AutoComplete: func(cursorIdx int, text []rune) []ui.Completion { return app.completions(cursorIdx, text) }, @@ -16,6 +16,7 @@ type Config struct { Highlights []string OnHighlight string `yaml:"on-highlight"` NickColWidth int `yaml:"nick-column-width"` + ChanColWidth int `yaml:"chan-column-width"` Debug bool } @@ -25,6 +26,9 @@ func ParseConfig(buf []byte) (cfg Config, err error) { if cfg.NickColWidth <= 0 { cfg.NickColWidth = 16 } + if cfg.ChanColWidth <= 0 { + cfg.ChanColWidth = 16 + } return } @@ -9,6 +9,7 @@ import ( type Config struct { NickColWidth int + ChanColWidth int AutoComplete func(cursorIdx int, text []rune) []Completion } @@ -178,24 +179,24 @@ func (ui *UI) InputEnter() (content string) { func (ui *UI) Resize() { w, h := ui.screen.Size() - ui.e.Resize(w - 25 - ui.config.NickColWidth) - ui.bs.ResizeTimeline(w-16, h-2, ui.config.NickColWidth) + ui.e.Resize(w - 9 - ui.config.ChanColWidth - ui.config.NickColWidth) + ui.bs.ResizeTimeline(w-ui.config.ChanColWidth, h-2, ui.config.NickColWidth) } func (ui *UI) Draw() { w, h := ui.screen.Size() - ui.e.Draw(ui.screen, 25+ui.config.NickColWidth, h-1) + ui.e.Draw(ui.screen, 9+ui.config.ChanColWidth+ui.config.NickColWidth, h-1) - ui.bs.DrawTimeline(ui.screen, 16, 0, ui.config.NickColWidth) - ui.bs.DrawVerticalBufferList(ui.screen, 0, 0, 16, h) - ui.drawStatusBar(16, h-2, w-16) + ui.bs.DrawTimeline(ui.screen, ui.config.ChanColWidth, 0, ui.config.NickColWidth) + ui.bs.DrawVerticalBufferList(ui.screen, 0, 0, ui.config.ChanColWidth, h) + ui.drawStatusBar(ui.config.ChanColWidth, h-2, w-ui.config.ChanColWidth) - for x := 16; x < 25+ui.config.NickColWidth; x++ { + for x := ui.config.ChanColWidth; x < 9+ui.config.ChanColWidth+ui.config.NickColWidth; x++ { ui.screen.SetContent(x, h-1, ' ', nil, tcell.StyleDefault) } st := tcell.StyleDefault.Foreground(colorFromCode(IdentColor(ui.prompt))) - printIdent(ui.screen, 23, h-1, ui.config.NickColWidth, st, ui.prompt) + printIdent(ui.screen, ui.config.ChanColWidth+7, h-1, ui.config.NickColWidth, st, ui.prompt) ui.screen.Show() } |
