~taiite/public-inbox

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
1

[PATCH senpai] Defer requesting the history after we recompute isAtTop

Details
Message ID
<20211119160453.11741-1-delthas@dille.cc>
DKIM signature
pass
Download raw message
Patch: +8 -2
Recomputing whether we're atTop is done in Draw().

So we should defer any requestHistory until after we're done drawing,
instead of doing it inside the scroll up/page up handlers.
---
 app.go | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/app.go b/app.go
index d652b97..2e251a9 100644
--- a/app.go
+++ b/app.go
@@ -94,6 +94,8 @@ type App struct {

	lastMessageTime time.Time
	lastCloseTime   time.Time

	refreshHistory bool
}

func NewApp(cfg Config) (app *App, err error) {
@@ -225,6 +227,10 @@ func (app *App) eventLoop() {
				currentMembers = s.Names(buffer)
			}
			app.win.Draw(currentMembers)
			if app.refreshHistory {
				app.refreshHistory = false
				app.requestHistory()
			}
		}
	}
}
@@ -406,7 +412,7 @@ func (app *App) handleMouseEvent(ev *tcell.EventMouse) {
			app.win.ScrollMemberUpBy(4)
		} else {
			app.win.ScrollUpBy(4)
			app.requestHistory()
			app.refreshHistory = true
		}
	}
	if ev.Buttons()&tcell.WheelDown != 0 {
@@ -441,7 +447,7 @@ func (app *App) handleKeyEvent(ev *tcell.EventKey) {
		app.win.Resize()
	case tcell.KeyCtrlU, tcell.KeyPgUp:
		app.win.ScrollUp()
		app.requestHistory()
		app.refreshHistory = true
	case tcell.KeyCtrlD, tcell.KeyPgDn:
		app.win.ScrollDown()
	case tcell.KeyCtrlN:

base-commit: 6014ba12270933c74018f2914713ec6fb2ed4a77
-- 
2.17.1
Details
Message ID
<c4565af6-dc76-6f3d-e75e-154b2a405bf8@hirtz.pm>
In-Reply-To
<20211119160453.11741-1-delthas@dille.cc> (view parent)
DKIM signature
pass
Download raw message
It's not really an issue to scroll twice when a CHATHISTORY request 
needs to be made.
Reply to thread Export thread (mbox)