summaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
Diffstat (limited to 'ui')
-rw-r--r--ui/buffers.go22
-rw-r--r--ui/ui.go4
2 files changed, 12 insertions, 14 deletions
diff --git a/ui/buffers.go b/ui/buffers.go
index 3e13302..9dc26c2 100644
--- a/ui/buffers.go
+++ b/ui/buffers.go
@@ -277,19 +277,17 @@ func (bs *BufferList) Add(netID, netName, title string) (i int, added bool) {
return len(bs.list) - 1, true
}
-func (bs *BufferList) Remove(title string) (ok bool) {
- lTitle := strings.ToLower(title)
- for i, b := range bs.list {
- if strings.ToLower(b.title) == lTitle {
- ok = true
- bs.list = append(bs.list[:i], bs.list[i+1:]...)
- if len(bs.list) <= bs.current {
- bs.current--
- }
- return
- }
+func (bs *BufferList) Remove(netID, title string) bool {
+ idx := bs.idx(netID, title)
+ if idx < 0 {
+ return false
+ }
+
+ bs.list = append(bs.list[:idx], bs.list[idx+1:]...)
+ if len(bs.list) <= bs.current {
+ bs.current--
}
- return
+ return true
}
func (bs *BufferList) AddLine(netID, title string, notify NotifyType, line Line) {
diff --git a/ui/ui.go b/ui/ui.go
index ec1fd09..97f7148 100644
--- a/ui/ui.go
+++ b/ui/ui.go
@@ -181,8 +181,8 @@ func (ui *UI) AddBuffer(netID, netName, title string) (i int, added bool) {
return ui.bs.Add(netID, netName, title)
}
-func (ui *UI) RemoveBuffer(title string) {
- _ = ui.bs.Remove(title)
+func (ui *UI) RemoveBuffer(netID, title string) {
+ _ = ui.bs.Remove(netID, title)
ui.memberOffset = 0
}