Adjust things in timestamp toggle
This commit is contained in:
parent
57d0c8db5f
commit
2cff2cdc22
@ -43,7 +43,7 @@ type AuthCache struct {
|
||||
type UserPreferences struct {
|
||||
HideUserList bool `yaml:"hide_user_list"`
|
||||
HideRoomList bool `yaml:"hide_room_list"`
|
||||
HideTimeStamp bool `yaml:"hide_time_stamp"`
|
||||
HideTimestamp bool `yaml:"hide_timestamp"`
|
||||
BareMessageView bool `yaml:"bare_message_view"`
|
||||
DisableImages bool `yaml:"disable_images"`
|
||||
DisableTypingNotifs bool `yaml:"disable_typing_notifs"`
|
||||
|
@ -703,7 +703,7 @@ func (nkm NewlineKeybindMessage) Name() string {
|
||||
var toggleMsg = map[string]ToggleMessage{
|
||||
"rooms": HideMessage("Room list sidebar"),
|
||||
"users": HideMessage("User list sidebar"),
|
||||
"timestamp": HideMessage("Message timestamp"),
|
||||
"timestamps": HideMessage("message timestamps"),
|
||||
"baremessages": SimpleToggleMessage("bare message view"),
|
||||
"images": SimpleToggleMessage("image rendering"),
|
||||
"typingnotif": SimpleToggleMessage("typing notifications"),
|
||||
@ -739,8 +739,8 @@ func cmdToggle(cmd *Command) {
|
||||
val = &cmd.Config.Preferences.HideRoomList
|
||||
case "users":
|
||||
val = &cmd.Config.Preferences.HideUserList
|
||||
case "timestamp":
|
||||
val = &cmd.Config.Preferences.HideTimeStamp
|
||||
case "timestamps":
|
||||
val = &cmd.Config.Preferences.HideTimestamp
|
||||
case "baremessages":
|
||||
val = &cmd.Config.Preferences.BareMessageView
|
||||
case "images":
|
||||
|
@ -160,10 +160,9 @@ func (view *MessageView) AddMessage(ifcMessage ifc.Message, direction MessageDir
|
||||
width := view.width()
|
||||
bare := view.config.Preferences.BareMessageView
|
||||
if !bare {
|
||||
if view.config.Preferences.HideTimeStamp {
|
||||
width -= TimestampSenderGap + view.widestSender() + SenderMessageGap
|
||||
} else {
|
||||
width -= view.TimestampWidth + TimestampSenderGap + view.widestSender() + SenderMessageGap
|
||||
width -= view.widestSender() + SenderMessageGap
|
||||
if !view.config.Preferences.HideTimestamp {
|
||||
width -= view.TimestampWidth + TimestampSenderGap
|
||||
}
|
||||
}
|
||||
message.CalculateBuffer(view.config.Preferences, width)
|
||||
@ -327,10 +326,9 @@ func (view *MessageView) recalculateBuffers() {
|
||||
if recalculateMessageBuffers || len(view.messages) != view.prevMsgCount {
|
||||
width := view.width()
|
||||
if !prefs.BareMessageView {
|
||||
if prefs.HideTimeStamp {
|
||||
width -= TimestampSenderGap + view.widestSender() + SenderMessageGap
|
||||
} else {
|
||||
width -= view.TimestampWidth + TimestampSenderGap + view.widestSender() + SenderMessageGap
|
||||
width -= view.widestSender() + SenderMessageGap
|
||||
if !prefs.HideTimestamp {
|
||||
width -= view.TimestampWidth + TimestampSenderGap
|
||||
}
|
||||
}
|
||||
view.msgBuffer = []*messages.UIMessage{}
|
||||
@ -443,9 +441,9 @@ func (view *MessageView) OnMouseEvent(event mauview.MouseEvent) bool {
|
||||
}
|
||||
view.msgBufferLock.RUnlock()
|
||||
|
||||
usernameX := view.TimestampWidth + TimestampSenderGap
|
||||
if !view.config.Preferences.HideTimeStamp {
|
||||
usernameX = TimestampSenderGap
|
||||
usernameX := 0
|
||||
if !view.config.Preferences.HideTimestamp {
|
||||
usernameX += view.TimestampWidth + TimestampSenderGap
|
||||
}
|
||||
messageX := usernameX + view.widestSender() + SenderMessageGap
|
||||
|
||||
@ -612,9 +610,9 @@ func (view *MessageView) Draw(screen mauview.Screen) {
|
||||
return
|
||||
}
|
||||
|
||||
usernameX := view.TimestampWidth + TimestampSenderGap
|
||||
if view.config.Preferences.HideTimeStamp {
|
||||
usernameX = TimestampSenderGap
|
||||
usernameX := 0
|
||||
if !view.config.Preferences.HideTimestamp {
|
||||
usernameX += view.TimestampWidth + TimestampSenderGap
|
||||
}
|
||||
messageX := usernameX + view.widestSender() + SenderMessageGap
|
||||
|
||||
@ -657,7 +655,7 @@ func (view *MessageView) Draw(screen mauview.Screen) {
|
||||
continue
|
||||
}
|
||||
|
||||
if len(msg.FormatTime()) > 0 && !view.config.Preferences.HideTimeStamp {
|
||||
if len(msg.FormatTime()) > 0 && !view.config.Preferences.HideTimestamp {
|
||||
widget.WriteLineSimpleColor(screen, msg.FormatTime(), 0, line, msg.TimestampColor())
|
||||
}
|
||||
// TODO hiding senders might not be that nice after all, maybe an option? (disabled for now)
|
||||
|
Loading…
Reference in New Issue
Block a user