aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJim Blandy1993-03-02 07:29:05 +0000
committerJim Blandy1993-03-02 07:29:05 +0000
commit5ba2dc3fd34c9f903816f277e08d7df061fa4c8d (patch)
treea5580c11f3fdc1ed620cc166aac2e092e7f79842
parent44c327f9596f64d9f3589df17347e06887f90dd1 (diff)
downloademacs-5ba2dc3fd34c9f903816f277e08d7df061fa4c8d.tar.gz
emacs-5ba2dc3fd34c9f903816f277e08d7df061fa4c8d.zip
* mouse.el (mouse-split-window-vertically): If the user clicks too
close to the top or bottom of a window, split at the closest reasonable line. Give a helpful error message if the window is too small to be split anywhere. (mouse-split-window-horizontally): Similar changes.
-rw-r--r--lisp/mouse.el22
1 files changed, 18 insertions, 4 deletions
diff --git a/lisp/mouse.el b/lisp/mouse.el
index 7994db2a92d..6285624f03a 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -107,14 +107,28 @@ This command must be bound to a mouse click."
107 (interactive "@e") 107 (interactive "@e")
108 (let ((start (event-start click))) 108 (let ((start (event-start click)))
109 (select-window (posn-window start)) 109 (select-window (posn-window start))
110 (split-window-vertically (1+ (cdr (posn-col-row click)))))) 110 (let ((new-height (1+ (cdr (posn-col-row (event-end click)))))
111 (first-line window-min-height)
112 (last-line (- (window-height) window-min-height)))
113 (if (< last-line first-line)
114 (error "window too short to split")
115 (split-window-vertically
116 (min (max new-height first-line) last-line))))))
111 117
112(defun mouse-split-window-horizontally (click) 118(defun mouse-split-window-horizontally (click)
113 "Select Emacs window mouse is on, then split it horizontally in half. 119 "Select Emacs window mouse is on, then split it horizontally in half.
114The window is split at the column clicked on. 120The window is split at the column clicked on.
115This command must be bound to a mouse click." 121This command must be bound to a mouse click."
116 (interactive "@e") 122 (interactive "@e")
117 (split-window-horizontally (1+ (car (posn-col-row (event-end click)))))) 123 (let ((start (event-start click)))
124 (select-window (posn-window start))
125 (let ((new-width (1+ (car (posn-col-row (event-end click)))))
126 (first-col window-min-width)
127 (last-col (- (window-width) window-min-width)))
128 (if (< last-col first-col)
129 (error "window too narrow to split")
130 (split-window-horizontally
131 (min (max new-width first-col) last-col))))))
118 132
119(defun mouse-set-point (click) 133(defun mouse-set-point (click)
120 "Move point to the position clicked on with the mouse. 134 "Move point to the position clicked on with the mouse.
@@ -240,7 +254,7 @@ and selects that window."
240 (select-window window) 254 (select-window window)
241 (switch-to-buffer buf)))))) 255 (switch-to-buffer buf))))))
242 256
243;;; These need to be rewritten for the new scrollbar implementation. 257;;; These need to be rewritten for the new scroll bar implementation.
244 258
245;;;!! ;; Commands for the scroll bar. 259;;;!! ;; Commands for the scroll bar.
246;;;!! 260;;;!!
@@ -482,7 +496,7 @@ and selects that window."
482;;;!! ;;; (define-key doubleclick-test-map mouse-button-left-up 'double-up)) 496;;;!! ;;; (define-key doubleclick-test-map mouse-button-left-up 'double-up))
483;;;!! 497;;;!!
484;;;!! ;; 498;;;!! ;;
485;;;!! ;; This scrolls while button is depressed. Use preferable in scrollbar. 499;;;!! ;; This scrolls while button is depressed. Use preferable in scroll bar.
486;;;!! ;; 500;;;!! ;;
487;;;!! 501;;;!!
488;;;!! (defvar scrolled-lines 0) 502;;;!! (defvar scrolled-lines 0)