Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
qingshuizheng opened this issue Jun 17, 2023 · 3 comments

Comments

@qingshuizheng
Copy link
Contributor

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!

@zevlg
Copy link
Owner

zevlg commented Mar 10, 2024

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

@qingshuizheng
Copy link
Contributor Author

Wow, that works @zevlg .

@qingshuizheng
Copy link
Contributor Author

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")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants