]> git.eshelyaron.com Git - emacs.git/commitdiff
* subr.el (posn-col-row): Properly compute line spacing.
authorChong Yidong <cyd@stupidchicken.com>
Wed, 15 Apr 2009 22:41:20 +0000 (22:41 +0000)
committerChong Yidong <cyd@stupidchicken.com>
Wed, 15 Apr 2009 22:41:20 +0000 (22:41 +0000)
Suggested by Nikolaj Schumacher (Bug#2933).

lisp/ChangeLog
lisp/subr.el

index 163b3e21ab938693bbb2fefedbceba11ea316cc2..88d37ed22a05b6efa68d5e982c19449145274544 100644 (file)
@@ -1,3 +1,8 @@
+2009-04-15  Chong Yidong  <cyd@stupidchicken.com>
+
+       * subr.el (posn-col-row): Properly compute line spacing.
+       Suggested by Nikolaj Schumacher (Bug#2933).
+
 2009-04-15  Ulf Jasper  <ulf.jasper@web.de>
 
        * net/newst-treeview.el (newsticker-treeview-jump): Enable virtual
index ffe8a9de5b112fe6f917011f5bd6d31e65f07b20..5372adb510cadcd3108fdccc8d71719e78bb8498 100644 (file)
@@ -930,13 +930,19 @@ and `event-end' functions."
       (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.