commit 196baeb
Hubert Hirtz
·
2020-08-24 06:48:32 +0000 UTC
parent 05c2fb4
Only fetch history on JOIN and PgUp
1 files changed,
+11,
-19
M
app.go
M
app.go
+11,
-19
1@@ -194,26 +194,32 @@ func (app *App) handleUIEvent(ev tcell.Event) {
2 app.win.Resize()
3 case tcell.KeyCtrlU, tcell.KeyPgUp:
4 app.win.ScrollUp()
5- app.requestHistory()
6+ if app.s == nil {
7+ return
8+ }
9+ buffer := app.win.CurrentBuffer()
10+ if app.win.IsAtTop() && buffer != ui.Home {
11+ at := time.Now()
12+ if t := app.win.CurrentBufferOldestTime(); t != nil {
13+ at = *t
14+ }
15+ app.s.RequestHistory(buffer, at)
16+ }
17 case tcell.KeyCtrlD, tcell.KeyPgDn:
18 app.win.ScrollDown()
19 case tcell.KeyCtrlN:
20 app.win.NextBuffer()
21- app.requestHistory()
22 case tcell.KeyCtrlP:
23 app.win.PreviousBuffer()
24- app.requestHistory()
25 case tcell.KeyRight:
26 if ev.Modifiers() == tcell.ModAlt {
27 app.win.NextBuffer()
28- app.requestHistory()
29 } else {
30 app.win.InputRight()
31 }
32 case tcell.KeyLeft:
33 if ev.Modifiers() == tcell.ModAlt {
34 app.win.PreviousBuffer()
35- app.requestHistory()
36 } else {
37 app.win.InputLeft()
38 }
39@@ -290,20 +296,6 @@ func (app *App) notifyHighlight(buffer, nick, content string) {
40 }
41 }
42
43-func (app *App) requestHistory() {
44- if app.s == nil {
45- return
46- }
47- buffer := app.win.CurrentBuffer()
48- if app.win.IsAtTop() && buffer != ui.Home {
49- at := time.Now()
50- if t := app.win.CurrentBufferOldestTime(); t != nil {
51- at = *t
52- }
53- app.s.RequestHistory(buffer, at)
54- }
55-}
56-
57 func (app *App) typing() {
58 if app.s == nil {
59 return