summaryrefslogtreecommitdiff
path: root/ui/buffers.go
diff options
context:
space:
mode:
Diffstat (limited to 'ui/buffers.go')
-rw-r--r--ui/buffers.go22
1 files changed, 10 insertions, 12 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) {