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).
This commit is contained in:
Milan Zamazal 2022-06-15 21:03:42 +02:00
parent 08c9d50a1c
commit 1065d9d389
1 changed files with 5 additions and 5 deletions

View File

@ -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)