1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-29 08:31:35 -08:00

* 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.
This commit is contained in:
Jim Blandy 1993-03-02 07:29:05 +00:00
parent 44c327f959
commit 5ba2dc3fd3

View file

@ -107,14 +107,28 @@ This command must be bound to a mouse click."
(interactive "@e")
(let ((start (event-start click)))
(select-window (posn-window start))
(split-window-vertically (1+ (cdr (posn-col-row click))))))
(let ((new-height (1+ (cdr (posn-col-row (event-end click)))))
(first-line window-min-height)
(last-line (- (window-height) window-min-height)))
(if (< last-line first-line)
(error "window too short to split")
(split-window-vertically
(min (max new-height first-line) last-line))))))
(defun mouse-split-window-horizontally (click)
"Select Emacs window mouse is on, then split it horizontally in half.
The window is split at the column clicked on.
This command must be bound to a mouse click."
(interactive "@e")
(split-window-horizontally (1+ (car (posn-col-row (event-end click))))))
(let ((start (event-start click)))
(select-window (posn-window start))
(let ((new-width (1+ (car (posn-col-row (event-end click)))))
(first-col window-min-width)
(last-col (- (window-width) window-min-width)))
(if (< last-col first-col)
(error "window too narrow to split")
(split-window-horizontally
(min (max new-width first-col) last-col))))))
(defun mouse-set-point (click)
"Move point to the position clicked on with the mouse.