aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2009-04-15 22:41:20 +0000
committerChong Yidong2009-04-15 22:41:20 +0000
commit7beba943eca576811305afdef5a471cee1f36fe6 (patch)
tree638caeb263908ba1ded6b95a15cf23062b549818
parented8ab760ef75888924f37746d025efaa00a84c76 (diff)
downloademacs-7beba943eca576811305afdef5a471cee1f36fe6.tar.gz
emacs-7beba943eca576811305afdef5a471cee1f36fe6.zip
* subr.el (posn-col-row): Properly compute line spacing.
Suggested by Nikolaj Schumacher (Bug#2933).
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/subr.el20
2 files changed, 18 insertions, 7 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 163b3e21ab9..88d37ed22a0 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
12009-04-15 Chong Yidong <cyd@stupidchicken.com>
2
3 * subr.el (posn-col-row): Properly compute line spacing.
4 Suggested by Nikolaj Schumacher (Bug#2933).
5
12009-04-15 Ulf Jasper <ulf.jasper@web.de> 62009-04-15 Ulf Jasper <ulf.jasper@web.de>
2 7
3 * net/newst-treeview.el (newsticker-treeview-jump): Enable virtual 8 * net/newst-treeview.el (newsticker-treeview-jump): Enable virtual
diff --git a/lisp/subr.el b/lisp/subr.el
index ffe8a9de5b1..5372adb510c 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -930,13 +930,19 @@ and `event-end' functions."
930 (cons (scroll-bar-scale pair (window-width window)) 0)) 930 (cons (scroll-bar-scale pair (window-width window)) 0))
931 (t 931 (t
932 (let* ((frame (if (framep window) window (window-frame window))) 932 (let* ((frame (if (framep window) window (window-frame window)))
933 (x (/ (car pair) (frame-char-width frame))) 933 ;; FIXME: This should take line-spacing properties on
934 (y (/ (cdr pair) (+ (frame-char-height frame) 934 ;; newlines into account.
935 (or (frame-parameter frame 'line-spacing) 935 (spacing (when (display-graphic-p frame)
936 ;; FIXME: Why the `default'? 936 (or (with-current-buffer (window-buffer window)
937 (default-value 'line-spacing) 937 line-spacing)
938 0))))) 938 (frame-parameter frame 'line-spacing)))))
939 (cons x y)))))) 939 (cond ((floatp spacing)
940 (setq spacing (truncate (* spacing
941 (frame-char-height frame)))))
942 ((null spacing)
943 (setq spacing 0)))
944 (cons (/ (car pair) (frame-char-width frame))
945 (/ (cdr pair) (+ (frame-char-height frame) spacing))))))))
940 946
941(defun posn-actual-col-row (position) 947(defun posn-actual-col-row (position)
942 "Return the actual column and row in POSITION, measured in characters. 948 "Return the actual column and row in POSITION, measured in characters.