]> git.eshelyaron.com Git - emacs.git/commitdiff
(scroll-bar-toolkit-scroll): Don't ring the bell
authorEli Zaretskii <eliz@gnu.org>
Fri, 19 Oct 2001 07:23:53 +0000 (07:23 +0000)
committerEli Zaretskii <eliz@gnu.org>
Fri, 19 Oct 2001 07:23:53 +0000 (07:23 +0000)
when we hit the beginning or the end of the buffer.  Instead, just
print a message and do nothing.

lisp/scroll-bar.el

index 493a271cf2339ea179cc31561c2d26e6cecd4849..29ad9a70dabdf48bfbec0cef74bea1b27b5893b2 100644 (file)
@@ -312,9 +312,23 @@ EVENT should be a scroll bar click."
                                       ((< (car portion-whole) 0) -1)
                                       (t 1)))))
                   ((eq part 'up)
-                   (scroll-up -1))
+                   ;; Avoid ringing the bell when at beginning of
+                   ;; buffer, since that causes redisplay to bitch
+                   ;; endlessly when visible-bell is in effect and
+                   ;; the toolkit sends us many scroll-bar clicks one
+                   ;; after the other.
+                   (if (= 0 (save-excursion
+                              (goto-char (window-start))
+                              (forward-line -1)))
+                       (scroll-up -1)
+                     (message "Beginning of buffer")))
                   ((eq part 'down)
-                   (scroll-up 1))
+                   ;; Avoid ringing the bell if already at end of
+                   ;; buffer; see the commentary above for the
+                   ;; reasons.
+                   (if (= 0 (save-excursion (forward-line 2)))
+                       (scroll-up 1)
+                     (message "End of buffer")))
                   ((eq part 'top)
                    (set-window-start window (point-min)))
                   ((eq part 'bottom)