diff options
Diffstat (limited to 'ui')
-rw-r--r-- | ui/buffers.go | 18 | ||||
-rw-r--r-- | ui/ui.go | 33 |
2 files changed, 34 insertions, 17 deletions
diff --git a/ui/buffers.go b/ui/buffers.go index 3a17b18..703fd1a 100644 --- a/ui/buffers.go +++ b/ui/buffers.go @@ -37,6 +37,7 @@ type Line struct { Highlight bool Readable bool Mergeable bool + Temporary bool Data interface{} splitPoints []point @@ -392,9 +393,12 @@ func (bs *BufferList) AddLine(netID, title string, line Line) { } else { if n != 0 { l := &b.lines[n-1] - if l.Head == line.Head || l.HeadTag == line.Head { + if l.Temporary { + b.lines = b.lines[:n-1] + } + if line.HeadTag == l.HeadTag || l.Head == line.Head || l.HeadTag == line.Head { line.HeadTag = line.Head - line.Head = "" + line.Head = "│" } } line.computeSplitPoints() @@ -435,9 +439,9 @@ func (bs *BufferList) AddLines(netID, title string, before, after []Line) { } if len(lines) > 0 { l := &lines[len(lines)-1] - if l.Head == line.Head || l.HeadTag == line.Head { + if line.HeadTag == l.HeadTag || l.Head == line.Head || l.HeadTag == line.Head { line.HeadTag = line.Head - line.Head = "" + line.Head = "│" } } lines = append(lines, line) @@ -595,6 +599,8 @@ func (bs *BufferList) DrawVerticalBufferList(screen tcell.Screen, x0, y0, width, st := tcell.StyleDefault if b.unread { st = st.Bold(true).Foreground(bs.colors.Unread) + } else { + st = st.Foreground(bs.colors.ChanForegroundInactive) } if bi == bs.current || bi == bs.clicked { st = st.Reverse(true) @@ -609,6 +615,7 @@ func (bs *BufferList) DrawVerticalBufferList(screen tcell.Screen, x0, y0, width, var title string if b.title == "" { title = b.netName + st.Foreground(bs.colors.ServerForeground) } else { if bi == bs.current || bi == bs.clicked { screen.SetContent(x, y, ' ', nil, tcell.StyleDefault.Reverse(true)) @@ -708,6 +715,7 @@ func (bs *BufferList) DrawHorizontalBufferList(screen tcell.Screen, x0, y0, widt break } st := tcell.StyleDefault + st = st.Foreground(bs.colors.ChanForegroundInactive) if b.unread { st = st.Bold(true).Foreground(bs.colors.Unread) } else if i == bs.current { @@ -719,7 +727,7 @@ func (bs *BufferList) DrawHorizontalBufferList(screen tcell.Screen, x0, y0, widt var title string if b.title == "" { - st = st.Dim(true) + st = st.Dim(true).Foreground(bs.colors.ServerForeground) title = b.netName } else { title = b.title @@ -11,21 +11,26 @@ import ( ) type Config struct { - NickColWidth int - ChanColWidth int - ChanColEnabled bool - MemberColWidth int - MemberColEnabled bool - TextMaxWidth int - AutoComplete func(cursorIdx int, text []rune) []Completion - Mouse bool - MergeLine func(former *Line, addition Line) - Colors ConfigColors + NickColWidth int + ChanColWidth int + ChanColEnabled bool + MemberColWidth int + MemberColEnabled bool + TextMaxWidth int + AutoComplete func(cursorIdx int, text []rune) []Completion + Mouse bool + MergeLine func(former *Line, addition Line) + Colors ConfigColors + HideMultiLineNickEnabled bool + HideMultiLineNickChar string } type ConfigColors struct { - Unread tcell.Color - Nicks ColorScheme + Unread tcell.Color + Nicks ColorScheme + ServerForeground tcell.Color + ChanForegroundInactive tcell.Color + ChanForegroundActive tcell.Color } type UI struct { @@ -58,6 +63,10 @@ func New(config Config) (ui *UI, err error) { ui.memberWidth = config.MemberColWidth } + if config.HideMultiLineNickEnabled && config.HideMultiLineNickChar == "" { + config.HideMultiLineNickChar = "│" + } + ui.screen, err = tcell.NewScreen() if err != nil { return |