emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] 170/255: fix spacing of labels when using image for display


From: Eric Schulte
Subject: [elpa] 170/255: fix spacing of labels when using image for display
Date: Sun, 16 Mar 2014 01:02:42 +0000

eschulte pushed a commit to branch go
in repository elpa.

commit 696daf8808cf4f9d9b426c6410b4382624df93f7
Author: Eric Schulte <address@hidden>
Date:   Tue Jun 5 23:17:37 2012 -0600

    fix spacing of labels when using image for display
---
 go-board.el |   28 ++++++++++++++++++----------
 1 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/go-board.el b/go-board.el
index 448e0c1..515552f 100644
--- a/go-board.el
+++ b/go-board.el
@@ -153,14 +153,17 @@
 
 ;;; Visualization
 (defun board-header (board)
-  (let ((size (board-size board)))
-    (concat "    "
-            (mapconcat (lambda (n)
-                         (let ((char (+ ?A n)))
-                           (when (>= char ?I)
-                             (setq char (+ 1 char)))
-                           (string char)))
-                       (range size) " "))))
+  (flet ((hd (str hd)
+             (put-text-property 0 1 :type `(,hd . :offboard) str)
+             str))
+    (let ((size (board-size board)))
+      (concat "   "
+              (hd " " :filler)
+              (mapconcat (lambda (n)
+                           (let ((char (+ ?A n)))
+                             (when (>= char ?I) (setq char (+ 1 char)))
+                             (hd (string char) :header)))
+                         (range size) (hd " " :filler))))))
 
 (defun board-pos-to-string (board pos)
   (let ((size (board-size board)))
@@ -231,7 +234,9 @@
                (overlay-put ovly 'face (sym-cat 'go-board face))
                (when go-board-use-images
                  (overlay-put ovly 'display
-                              (eval (sym-cat 'go-board 'image face back))))
+                              (if (equal face 'filler)
+                                  '(space :width (18))
+                                (eval (sym-cat 'go-board 'image face back)))))
                (push ovly *go-board-overlays*)))
          (hide (point)
                (let ((ovly (make-overlay point (1+ point))))
@@ -248,8 +253,11 @@
                       (:t  'top)
                       (:b  'bottom)
                       (:l  'left)
-                      (:r  'right))))
+                      (:r  'right)
+                      (:offboard 'offboard))))
           (case (car (get-text-property point :type))
+            (:header       nil)
+            (:filler       (ov point 'filler back))
             (:hoshi        (ov point 'hoshi))
             (:white        (ov point 'white back))
             (:black        (ov point 'black back))



reply via email to

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