]> git.eshelyaron.com Git - emacs.git/commitdiff
(mldrag-drag-vertical-line): Handle left-side scroll bars.
authorRichard M. Stallman <rms@gnu.org>
Fri, 16 Jan 1998 19:11:33 +0000 (19:11 +0000)
committerRichard M. Stallman <rms@gnu.org>
Fri, 16 Jan 1998 19:11:33 +0000 (19:11 +0000)
lisp/mldrag.el

index 45a10c2e18c469cb4982314636d003b1b300992c..d709062376724f28944a63acebf6246589b8b222 100644 (file)
@@ -153,17 +153,21 @@ usefully bound with the `vertical-line' or the `vertical-scroll-bar'
 prefix.  Holding down a mouse button and moving the mouse left and
 right will make the clicked-on window thinner or wider."
   (interactive "e")
-  (let ((done nil)
-       (echo-keystrokes 0)
-       (start-event-frame (window-frame (car (car (cdr start-event)))))
-       (start-event-window (car (car (cdr start-event))))
-       (start-nwindows (count-windows t))
-       (old-selected-window (selected-window))
-       event mouse x left right edges wconfig growth)
+  (let* ((done nil)
+        (echo-keystrokes 0)
+        (start-event-frame (window-frame (car (car (cdr start-event)))))
+        (scroll-bar-left
+         (eq (cdr (assq 'vertical-scroll-bars (frame-parameters))) 'left))
+        (start-event-window (car (car (cdr start-event))))
+        (start-nwindows (count-windows t))
+        (old-selected-window (selected-window))
+        event mouse x left right edges wconfig growth)
     (if (one-window-p t)
        (error "Attempt to resize sole ordinary window"))
-    (if (= (nth 2 (window-edges start-event-window))
-          (frame-width start-event-frame))
+    (if (if scroll-bar-left
+           (= (nth 2 (window-edges start-event-window))
+              (frame-width start-event-frame))
+         (= (nth 0 (window-edges start-event-window)) 0))
        (error "Attempt to drag rightmost scrollbar"))
     (unwind-protect
        (track-mouse
@@ -204,13 +208,20 @@ right will make the clicked-on window thinner or wider."
                           edges (window-edges)
                           left (nth 0 edges)
                           right (nth 2 edges))
+                    (setq foo (cons (list x left) foo))
                     ;; scale back a move that would make the
                     ;; window too thin.
-                    (cond ((< (- x left -1) window-min-width)
-                           (setq x (+ left window-min-width -1))))
+                    (if scroll-bar-left
+                        (cond ((< (- right x) window-min-width)
+                             (setq x (- right window-min-width))))
+                      (cond ((< (- x left -1) window-min-width)
+                             (setq x (+ left window-min-width -1)))))
                     ;; compute size change needed
-                    (setq growth (- x right -1)
+                    (setq growth (if scroll-bar-left
+                                     (- left x)
+                                   (- x right -1))
                           wconfig (current-window-configuration))
+                    (message "%s" growth)
                     (enlarge-window growth t)
                     ;; if this window's growth caused another
                     ;; window to be deleted because it was too
@@ -220,7 +231,9 @@ right will make the clicked-on window thinner or wider."
                     ;; from a window to the left of this one,
                     ;; rescind the change.
                     (if (or (/= start-nwindows (count-windows t))
-                            (/= left (nth 0 (window-edges))))
+                            (if scroll-bar-left
+                                (/= right (nth 2 (window-edges)))
+                              (/= left (nth 0 (window-edges)))))
                         (set-window-configuration wconfig)))))))
       ;; restore the old selected window
       (select-window old-selected-window))))