telega.el icon indicating copy to clipboard operation
telega.el copied to clipboard

Telega won't load newer history with scroll-down, when the buffer height is high

Open qingshuizheng opened this issue 1 year ago • 3 comments

Telega Setup

OS: macOS 11.7.3 Emacs: GNU Emacs 30.0.50 (build 1, x86_64-apple-darwin20.6.0, NS appkit-2202.70 Version 11.7.3 (Build 20G1116)) Features: svg webp ffmpeg Telega: telega v0.8.140 (TDLib v1.8.14-66234ae) (telega-server v0.8.2)

Current Behavior

Telega won't load newer history with scrolling down, when the buffer height is high (in my case 67 lines). It loads properly when the buffer height is lower, say, 20 lines. This is discussed starting from here: https://t.me/emacs_telega/40402 .

Let me know if you need any further info. Thanks!

qingshuizheng avatar Jun 17 '23 01:06 qingshuizheng

Try this setting (setq scroll-error-top-bottom t), does it work for you?

zevlg avatar Mar 10 '24 07:03 zevlg

Wow, that works @zevlg .

qingshuizheng avatar Mar 10 '24 14:03 qingshuizheng

Usually I have to do this to achieve the same result.


Commit Message: Loading new msg on scroll: 2000 -> 6000

1 file changed, 5 insertions(+), 5 deletions(-)
telega-chat.el | 10 +++++-----

modified   telega-chat.el
@@ -2719,7 +2719,7 @@ Recover previous active action after BODY execution."
 
       ;; If scrolling in inactive window (with C-M-v) we might need to
       ;; fetch new history if point near the buffer bottom
-      (when (and (> display-start (- (point-max) 2000))
+      (when (and (> display-start (- (point-max) 6000))
                  (not telega-chatbuf--history-loading)
                  (telega-chatbuf--need-newer-history-p))
         (telega-chatbuf--load-newer-history)))
@@ -2776,7 +2776,7 @@ Recover previous active action after BODY execution."
 
   ;; If point moves near the beginning of chatbuf, then request for
   ;; the older history
-  (when (and (< (point) 2000)
+  (when (and (< (point) 6000)
              (not telega-chatbuf--history-loading)
              (telega-chatbuf--need-older-history-p))
     (telega-chatbuf--load-older-history))
@@ -2785,7 +2785,7 @@ Recover previous active action after BODY execution."
   ;; newer history
   ;; NOTE: Do not load newer history if prompt is active (reply or
   ;; edit)
-  (when (and (> (point) (- (point-max) 2000))
+  (when (and (> (point) (- (point-max) 6000))
              (not telega-chatbuf--history-loading)
              (telega-chatbuf--need-newer-history-p))
     (telega-chatbuf--load-newer-history))
@@ -3088,7 +3088,7 @@ If NO-HISTORY-LOAD is specified, do not try to load history."
   "Return non-nil if newer history can be loaded."
   (and (not (telega-chatbuf--last-msg-loaded-p))
        (if (telega-chatbuf--history-state-get :newer-freezed)
-           (< (- (point-max) (point)) 2000)
+           (< (- (point-max) (point)) 6000)
          t)
        ;; Not editing or replying
        (not telega-chatbuf--aux-plist)
@@ -3776,7 +3776,7 @@ First message in MESSAGE will be first message at the beginning."
                ;; Allow loading few more messages when newer history
                ;; is freezed
                (and (telega-chatbuf--history-state-get :newer-freezed)
-                    (> (- (point-max) (point)) 2000)))
+                    (> (- (point-max) (point)) 6000)))
            ;; Update history state by side-effect
            (telega-chatbuf--history-state-delete :newer-loaded)
            (telega-chatbuf--chat-update "history-loading")

qingshuizheng avatar Mar 10 '24 14:03 qingshuizheng