Fix pw-cli--parse-properties

- Remove some redundancy.
- Make sure we don’t search after the end point.
- Move to the end point (this is necessary for parsing the following
  object).
main
Milan Zamazal 8 months ago
parent 08c9d50a1c
commit 1065d9d389

@ -153,17 +153,17 @@ Note this interface may not work with all PipeWire versions.")
(defun pw-cli--parse-properties ()
(pw-cli--next-line)
(let ((end (save-excursion
(or (and (re-search-forward "^ Object:" nil t)
(point))
(point-max))))
(let ((end (or (save-excursion (re-search-forward "^ Object:" nil t))
(point-max)))
(properties '()))
(while (re-search-forward "^ Prop: key \\([A-Za-z:]+\\)" end t)
(while (and (< (point) end)
(re-search-forward "^ Prop: key \\([A-Za-z:]+\\)" end t))
(pw-cli--next-line)
(let ((property (car (last (split-string (match-string 1) ":"))))
(value (pw-cli--read-property)))
(when value
(push (cons property value) properties))))
(goto-char end)
properties))
(cl-defmethod pw-access-properties ((_class pw-cli-accessor) node-id)

Loading…
Cancel
Save