(gnus-spec-tab): Make a Lisp form which works correctly even if there are wide
authorKatsumi Yamaoka <yamaoka@jpl.org>
Wed, 22 Dec 2004 03:27:58 +0000 (03:27 +0000)
committerKatsumi Yamaoka <yamaoka@jpl.org>
Wed, 22 Dec 2004 03:27:58 +0000 (03:27 +0000)
 characters.

lisp/ChangeLog
lisp/gnus-spec.el

index e223d24..4b7f735 100644 (file)
@@ -1,3 +1,8 @@
+2004-12-22  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+       * gnus-spec.el (gnus-spec-tab): Make a Lisp form which works
+       correctly even if there are wide characters.
+
 2004-12-21  Teodor Zlatanov  <tzz@lifelogs.com>
 
        * spam.el (spam-check-BBDB): fix the BBDB caching code to use
index cd8a36f..8a69b9b 100644 (file)
@@ -281,21 +281,15 @@ Return a list of updated types."
 
 (defun gnus-spec-tab (column)
   (if (> column 0)
-      `(insert (make-string (max (- ,column (current-column)) 0) ? ))
+      `(insert-char ?  (max (- ,column (current-column)) 0))
     (let ((column (abs column)))
-      (if gnus-use-correct-string-widths
-         `(progn
-            (if (> (current-column) ,column)
-                (while (progn
-                         (delete-backward-char 1)
-                         (> (current-column) ,column))))
-            (insert (make-string (max (- ,column (current-column)) 0) ? )))
-       `(progn
-          (if (> (current-column) ,column)
-              (delete-region (point)
-                             (- (point) (- (current-column) ,column)))
-            (insert (make-string (max (- ,column (current-column)) 0)
-                                 ? ))))))))
+      `(if (> (current-column) ,column)
+          (let ((end (point)))
+            (if (= (move-to-column ,column) ,column)
+                (delete-region (point) end)
+              (delete-region (1- (point)) end)
+              (insert " ")))
+        (insert-char ?  (max (- ,column (current-column)) 0))))))
 
 (defun gnus-correct-length (string)
   "Return the correct width of STRING."