(fix)completions: use full string (#1754)

When strings in org-roam-node-display-template are truncated, they are
no longer searchable using completions, resulting in suprising
behaviour. This change allows truncated strings to still be searched
according to their original value. Closes #1728.
This commit is contained in:
Jethro Kuan
2021-08-09 15:38:23 +08:00
committed by GitHub
parent 3c396f9e91
commit 1f853ad8e6

View File

@@ -481,12 +481,13 @@ Uses `org-roam-node-display-template' to format the entry."
(if (not field-width) (if (not field-width)
field-value field-value
(setq field-width (string-to-number field-width)) (setq field-width (string-to-number field-width))
(truncate-string-to-width (propertize field-value
'display (truncate-string-to-width
field-value field-value
(if (> field-width 0) (if (> field-width 0)
field-width field-width
(- width (cdr fmt))) (- width (cdr fmt)))
0 ?\s))))))) 0 ?\s))))))))
(defun org-roam-node-read--process-display-format (format) (defun org-roam-node-read--process-display-format (format)
"Pre-calculate minimal widths needed by the FORMAT string." "Pre-calculate minimal widths needed by the FORMAT string."