# HG changeset patch # User Chong Yidong # Date 1239835280 0 # Node ID 9455676485553860838487eaef60307ca7b9d4fb # Parent ab2250dc98c73d9479f792bb6ca75f464bdcb96d * subr.el (posn-col-row): Properly compute line spacing. Suggested by Nikolaj Schumacher (Bug#2933). diff -r ab2250dc98c7 -r 945567648555 lisp/subr.el --- a/lisp/subr.el Wed Apr 15 22:39:51 2009 +0000 +++ b/lisp/subr.el Wed Apr 15 22:41:20 2009 +0000 @@ -930,13 +930,19 @@ (cons (scroll-bar-scale pair (window-width window)) 0)) (t (let* ((frame (if (framep window) window (window-frame window))) - (x (/ (car pair) (frame-char-width frame))) - (y (/ (cdr pair) (+ (frame-char-height frame) - (or (frame-parameter frame 'line-spacing) - ;; FIXME: Why the `default'? - (default-value 'line-spacing) - 0))))) - (cons x y)))))) + ;; FIXME: This should take line-spacing properties on + ;; newlines into account. + (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 + (frame-char-height frame))))) + ((null spacing) + (setq spacing 0))) + (cons (/ (car pair) (frame-char-width frame)) + (/ (cdr pair) (+ (frame-char-height frame) spacing)))))))) (defun posn-actual-col-row (position) "Return the actual column and row in POSITION, measured in characters.