Add room name to topic bar if room list is hidden. Closes #317
This commit is contained in:
parent
073739b79b
commit
686f7025cb
@ -845,6 +845,10 @@ func cmdToggle(cmd *Command) {
|
||||
*val = !(*val)
|
||||
debug.Print(thing, *val)
|
||||
cmd.Reply(toggleMsg[thing].Format(*val))
|
||||
if thing == "rooms" {
|
||||
// Update topic string to include or not include room name
|
||||
cmd.Room.Update()
|
||||
}
|
||||
}
|
||||
cmd.UI.Render()
|
||||
go cmd.Matrix.SendPreferencesToMatrix()
|
||||
|
@ -836,7 +836,16 @@ func (view *RoomView) MxRoom() *rooms.Room {
|
||||
}
|
||||
|
||||
func (view *RoomView) Update() {
|
||||
view.topic.SetText(strings.Replace(view.Room.GetTopic(), "\n", " ", -1))
|
||||
topicStr := strings.TrimSpace(strings.ReplaceAll(view.Room.GetTopic(), "\n", " "))
|
||||
if view.config.Preferences.HideRoomList {
|
||||
if len(topicStr) > 0 {
|
||||
topicStr = fmt.Sprintf("%s - %s", view.Room.GetTitle(), topicStr)
|
||||
} else {
|
||||
topicStr = view.Room.GetTitle()
|
||||
}
|
||||
topicStr = strings.TrimSpace(topicStr)
|
||||
}
|
||||
view.topic.SetText(topicStr)
|
||||
if !view.userListLoaded {
|
||||
view.UpdateUserList()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user