summaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
authorJordan Bracco <href@random.sh>2023-01-15 17:25:25 +0100
committerJordan Bracco <href@random.sh>2023-01-15 17:32:46 +0100
commitcc80d8c82c2d510ab14e9dd58316cf748c653b08 (patch)
tree76c41e3aa7c765c00bbfe71f5a447030831413b1 /ui
parentfeat(ui): improve /TOPIC ui (diff)
Multi-WIP that I probably should have done in multiples commits:
- more colors settings: - server foreground - channel foreground (active, inactive) - dumb cosmetic changes because why not (`!` -> `:(`, coloring) - temporary lines to unclutter main ui from disconnections/reconnections - display line head only once in case of multiple lines - cosmetic motd - handle 396 numeric as "server" head - improved ACTION display - imrpoved topic display bugs: - ACTION fucks up with multi-line head - multi-line head needs rework before trying upstream - what the fuck to with my cosmetic changes - document new config values
Diffstat (limited to 'ui')
-rw-r--r--ui/buffers.go18
-rw-r--r--ui/ui.go33
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
diff --git a/ui/ui.go b/ui/ui.go
index 859f32a..d37c495 100644
--- a/ui/ui.go
+++ b/ui/ui.go
@@ -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