summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorcitrons <citrons@mondecitronne.com>2025-06-09 15:20:56 -0500
committercitrons <citrons@mondecitronne.com>2025-06-09 15:20:56 -0500
commit462331590c8929bc2f1eb6266c701ff319dd38c3 (patch)
treec6dbfe4d3ef6a6cffae494c69e46faa9268ddb15 /client
parented7f662431a8e29a4ed27805c174ee72b4a7346a (diff)
only open history view if message is not onscreen
Diffstat (limited to 'client')
-rw-r--r--client/channel_window.go19
1 files changed, 15 insertions, 4 deletions
diff --git a/client/channel_window.go b/client/channel_window.go
index 3aed4c0..0e16af2 100644
--- a/client/channel_window.go
+++ b/client/channel_window.go
@@ -28,6 +28,7 @@ type channelWindow struct {
endOfHistory bool
startOfHistory bool
jumpedTo buffer.Message
+ highlight string
}
type channelMsg struct {
@@ -375,11 +376,23 @@ func (cw *channelWindow) ShowComposingReply() {
}
func (cw *channelWindow) OnNavigate() {
+ if cw.location.jumpTo != "" {
+ cw.highlight = cw.location.jumpTo
+ }
if cw.jumpedTo != nil {
cw.Buf.ScrollTo(cw.jumpedTo.Id())
}
}
+func (cw *channelWindow) goToMessage(id string) {
+ if tui.IsVisible("buffer." + id) {
+ cw.highlight = id
+ } else {
+ globalApp.goTo(channelLocation {id: cw.location.id, jumpTo: id})
+ }
+}
+
+
func (m channelMsg) Id() string {
return "buffer." + m.Object.Id
}
@@ -446,9 +459,7 @@ func (m channelMsg) showReply(bg int32, replyTo *proto.Object) {
})
if replyTo != nil && mouse.Button == 0 && mouse.Pressed {
- globalApp.goTo(channelLocation {
- id: m.window.location.id, jumpTo: replyTo.Id,
- })
+ m.window.goToMessage(replyTo.Id)
globalApp.redraw = true
}
@@ -485,7 +496,7 @@ func (m channelMsg) showReply(bg int32, replyTo *proto.Object) {
func (m channelMsg) Show(odd bool) {
var bg int32 = colorDefault[odd]
- if m.Object.Id == m.window.location.jumpTo {
+ if m.Object.Id == m.window.highlight {
bg = 17
}
tui.Push("", tui.Box {