emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs/lisp subr.el


From: Chong Yidong
Subject: [Emacs-diffs] emacs/lisp subr.el
Date: Wed, 15 Apr 2009 22:41:21 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Chong Yidong <cyd>      09/04/15 22:41:21

Modified files:
        lisp           : subr.el 

Log message:
        * subr.el (posn-col-row): Properly compute line spacing.
        Suggested by Nikolaj Schumacher (Bug#2933).

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/subr.el?cvsroot=emacs&r1=1.635&r2=1.636

Patches:
Index: subr.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/subr.el,v
retrieving revision 1.635
retrieving revision 1.636
diff -u -b -r1.635 -r1.636
--- subr.el     19 Mar 2009 14:45:06 -0000      1.635
+++ subr.el     15 Apr 2009 22:41:20 -0000      1.636
@@ -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.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]