]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix bug #9246 with scrolling in ERC under word-wrap.
authorAntoine Levitt <antoine.levitt@gmail.com>
Sat, 31 Dec 2011 08:25:48 +0000 (10:25 +0200)
committerEli Zaretskii <eliz@gnu.org>
Sat, 31 Dec 2011 08:25:48 +0000 (10:25 +0200)
 lisp/erc/erc-goodies.el (erc-scroll-to-bottom): Use post-command-hook
 rather than window-scroll-functions.  Fixes a bug with scrolling under
 word-wrap on a tty.

lisp/erc/ChangeLog
lisp/erc/erc-goodies.el

index 1b67835cb07c5976cf164384c6f67793a76c8e31..354e8636702860557966ea1c2b56d9274d428b1b 100644 (file)
@@ -1,3 +1,9 @@
+2011-12-31  Antoine Levitt  <antoine.levitt@gmail.com>
+
+       * erc-goodies.el (erc-scroll-to-bottom): Use post-command-hook
+       rather than window-scroll-functions.  Fixes a bug with word-wrap on
+       a tty.  (Bug#9246)
+
 2011-11-28  Mike Kazantsev  <mk.fraggod@gmail.com>  (tiny change)
 
        * erc-dcc.el (erc-dcc-ctcp-query-send-regexp): Updated regexp to
index b2cf9e356228205b4c1bb2e3c22db319211a0a99..6f24c59f4bdb6e0ec0e47d1a06b7c7ff2a7387e7 100644 (file)
@@ -60,7 +60,7 @@ argument to `recenter'."
   ((remove-hook 'erc-mode-hook 'erc-add-scroll-to-bottom)
    (dolist (buffer (erc-buffer-list))
      (with-current-buffer buffer
-       (remove-hook 'window-scroll-functions 'erc-scroll-to-bottom t)))))
+       (remove-hook 'post-command-hook 'erc-scroll-to-bottom t)))))
 
 (defun erc-add-scroll-to-bottom ()
   "A hook function for `erc-mode-hook' to recenter output at bottom of window.
@@ -70,35 +70,29 @@ the value of `erc-input-line-position'.
 
 This works whenever scrolling happens, so it's added to
 `window-scroll-functions' rather than `erc-insert-post-hook'."
-  ;;(make-local-hook 'window-scroll-functions)
-  (add-hook 'window-scroll-functions 'erc-scroll-to-bottom nil t))
+  (add-hook 'post-command-hook 'erc-scroll-to-bottom nil t))
 
-(defun erc-scroll-to-bottom (window display-start)
+(defun erc-scroll-to-bottom ()
   "Recenter WINDOW so that `point' is on the last line.
 
 This is added to `window-scroll-functions' by `erc-add-scroll-to-bottom'.
 
 You can control which line is recentered to by customizing the
-variable `erc-input-line-position'.
-
-DISPLAY-START is ignored."
-  (if (window-live-p window)
+variable `erc-input-line-position'."
       ;; Temporarily bind resize-mini-windows to nil so that users who have it
       ;; set to a non-nil value will not suffer from premature minibuffer
       ;; shrinkage due to the below recenter call.  I have no idea why this
       ;; works, but it solves the problem, and has no negative side effects.
       ;; (Fran Litterio, 2003/01/07)
-      (let ((resize-mini-windows nil))
-        (erc-with-selected-window window
-          (save-restriction
-            (widen)
-            (when (and erc-insert-marker
-                       ;; we're editing a line. Scroll.
-                       (> (point) erc-insert-marker))
-              (save-excursion
-                (goto-char (point-max))
-                (recenter (or erc-input-line-position -1))
-                (sit-for 0))))))))
+  (let ((resize-mini-windows nil))
+    (save-restriction
+      (widen)
+      (when (and erc-insert-marker
+                ;; we're editing a line. Scroll.
+                (> (point) erc-insert-marker))
+       (save-excursion
+         (goto-char (point-max))
+         (recenter (or erc-input-line-position -1)))))))
 
 ;;; Make read only
 (define-erc-module readonly nil