Function: picture-mouse-set-point
picture-mouse-set-point is an interactive and byte-compiled function
defined in picture.el.gz.
Signature
(picture-mouse-set-point EVENT)
Documentation
Move point to the position of EVENT, making whitespace if necessary.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/textmodes/picture.el.gz
(defun picture-mouse-set-point (event)
"Move point to the position of EVENT, making whitespace if necessary."
(interactive "e")
(let ((position (event-start event)))
(unless (posn-area position) ; Ignore EVENT unless in text area
(let* ((window (posn-window position))
(frame (if (framep window) window (window-frame window)))
(pair (posn-x-y position))
(start-pos (window-start window))
(start-pair (posn-x-y (posn-at-point start-pos)))
(dx (- (car pair) (car start-pair)))
(dy (- (cdr pair) (cdr start-pair)))
(char-ht (frame-char-height frame))
(spacing (when (display-graphic-p frame)
(or (with-current-buffer (window-buffer window)
line-spacing)
(frame-parameter frame 'line-spacing)))))
(cond ((floatp spacing)
(setq spacing (truncate (* spacing char-ht))))
((null spacing)
(setq spacing 0)))
(goto-char start-pos)
(picture-move-down (/ dy (+ char-ht spacing)))
(picture-forward-column (/ dx (frame-char-width frame)))))))