mirror of
https://github.com/org-roam/org-roam
synced 2025-09-28 16:50:58 -05:00
(fix)completions: allow empty field-width (#1785)
This allows the empty field-width to be used, but using an empty field-width will result in misalignment. This is useful for people who use completion frameworks like Ido.
This commit is contained in:
@@ -497,6 +497,8 @@ Uses `org-roam-node-display-template' to format the entry."
|
|||||||
v))
|
v))
|
||||||
field-value " "))
|
field-value " "))
|
||||||
(setq field-width (cond
|
(setq field-width (cond
|
||||||
|
((not field-width)
|
||||||
|
field-width)
|
||||||
((string-equal field-width "*")
|
((string-equal field-width "*")
|
||||||
(- width tmpl-width))
|
(- width tmpl-width))
|
||||||
((>= (string-to-number field-width) 0)
|
((>= (string-to-number field-width) 0)
|
||||||
@@ -505,7 +507,9 @@ Uses `org-roam-node-display-template' to format the entry."
|
|||||||
;; empty string results in an empty string and misalignment for candidates that
|
;; 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
|
;; 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.
|
;; when the field-value is "" so that we actually take up space.
|
||||||
(let ((display-string (truncate-string-to-width field-value field-width 0 ?\s)))
|
(let ((display-string (if field-width
|
||||||
|
(truncate-string-to-width field-value field-width 0 ?\s)
|
||||||
|
field-value)))
|
||||||
(if (equal field-value "")
|
(if (equal field-value "")
|
||||||
display-string
|
display-string
|
||||||
;; Remove properties from the full candidate string, otherwise the display
|
;; Remove properties from the full candidate string, otherwise the display
|
||||||
|
Reference in New Issue
Block a user