summaryrefslogtreecommitdiff
path: root/app.go
diff options
context:
space:
mode:
authorNomeji <nomeji@saucisseroyale.cc>2022-06-23 12:05:32 +0200
committerdelthas <delthas@dille.cc>2022-07-22 17:50:50 +0200
commitb75cb83397e32fc3bc8ead40f34efadafda6fb70 (patch)
treedf3a9aedc19dab333fd054d40576ee47ca4c250a /app.go
parentFix dropping words in /msg, /query, /part (diff)
Scroll to the channel when changing the horizontal channel
Previously, when running CTRL+N or CTRL+P to go to the next or previous channel, with the horizontal channel mode, the selected channel could appear offscreen. This patch ensures that we scroll just enough to make the newly selected chan visible. Thanks to Nomeji for his hard work on this. Adapted slightly to refactor existing code to use the newly created width computation routine.
Diffstat (limited to 'app.go')
-rw-r--r--app.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/app.go b/app.go
index 9f86b99..4d5e5b3 100644
--- a/app.go
+++ b/app.go
@@ -514,8 +514,10 @@ func (app *App) handleKeyEvent(ev *tcell.EventKey) {
app.win.ScrollDown()
case tcell.KeyCtrlN:
app.win.NextBuffer()
+ app.win.HorizontalBufferScrollTo()
case tcell.KeyCtrlP:
app.win.PreviousBuffer()
+ app.win.HorizontalBufferScrollTo()
case tcell.KeyRight:
if ev.Modifiers() == tcell.ModAlt {
app.win.NextBuffer()