(fix)completion: annotation fixes (#1904)

* (fix)Formatter: Ensure that strings are always padded up to the field width

* (feat)Colorize tags by default with org-tag face
This commit is contained in:
Daniel Mendler
2021-10-13 18:24:39 +02:00
committed by GitHub
parent 617e0021f5
commit e9299297f9

View File

@@ -37,7 +37,7 @@
;;; Options
;;;; Completing-read
(defcustom org-roam-node-display-template
"${title:*} ${tags:10}"
(concat "${title:*} " (propertize "${tags:10}" 'face 'org-tag))
"Configures display formatting for Org-roam node.
Patterns of form \"${field-name:length}\" are interpolated based
on the current node.
@@ -532,11 +532,7 @@ Uses `org-roam-node-display-template' to format the entry."
(- width tmpl-width))
((>= (string-to-number field-width) 0)
(string-to-number field-width))))
;; Setting the display (which would be padded out to the field length) for an
;; empty string results in an empty string and misalignment for candidates that
;; don't have some field. This uses the actual display string, made of spaces
;; when the field-value is "" so that we actually take up space.
(unless (or (not field-width) (equal field-value ""))
(when field-width
(let* ((truncated (truncate-string-to-width field-value field-width 0 ?\s))
(tlen (length truncated))
(len (length field-value)))