Browse Source

Merge branch 'maint'

Nicolas Goaziou 8 years ago
parent
commit
3fd361eb77
2 changed files with 20 additions and 1 deletions
  1. 1 1
      lisp/org.el
  2. 19 0
      testing/lisp/test-org.el

+ 1 - 1
lisp/org.el

@@ -14937,7 +14937,7 @@ If ONOFF is `on' or `off', don't toggle but set to this state."
     (if	(and (looking-at ".*?\\([ \t]+\\)\\(:[[:alnum:]_@#%:]+:\\)[ \t]*$")
 	     (< pos (match-beginning 2)))
 	(progn
-	  (setq tags-l (- (match-end 2) (match-beginning 2)))
+	  (setq tags-l (string-width (match-string 2)))
 	  (goto-char (match-beginning 1))
 	  (insert " ")
 	  (delete-region (point) (1+ (match-beginning 2)))

+ 19 - 0
testing/lisp/test-org.el

@@ -4452,6 +4452,25 @@ Paragraph<point>"
    (org-tag-alist-to-groups
     '((:startgroup) ("group") ("t1") ("t2") (:endgroup)))))
 
+(ert-deftest test-org/tag-align ()
+  "Test `org-align-tags-here' with different display width."
+  (should
+   ;;      12345678901234567890
+   (equal "* Test         :abc:"
+	  (org-test-with-temp-text "* Test :abc:"
+	    (let ((org-tags-column -20)
+		  (indent-tabs-mode nil))
+	     (org-fix-tags-on-the-fly))
+	    (buffer-string))))
+  (should
+   ;;      12345678901234567890
+   (equal "* Test      :日本語:"
+	  (org-test-with-temp-text "* Test :日本語:"
+	    (let ((org-tags-column -20)
+		  (indent-tabs-mode nil))
+	     (org-fix-tags-on-the-fly))
+	    (buffer-string)))))
+
 
 ;;; Timestamps API