summaryrefslogtreecommitdiffstats
path: root/DOCS/man/input.rst
diff options
context:
space:
mode:
authorKacper Michajłow <kasper93@gmail.com>2023-11-19 21:22:24 +0100
committerKacper Michajłow <kasper93@gmail.com>2024-03-21 03:50:11 +0100
commit8708f4dc918b1bc005149c50abb3d54d66ed3047 (patch)
treea542bb97e54ba7f6287c755ece5fe1d73bd4b910 /DOCS/man/input.rst
parentc84bb1ce67f2dd3adb974c49a66d28c0cf55d39d (diff)
downloadmpv-8708f4dc918b1bc005149c50abb3d54d66ed3047.tar.bz2
mpv-8708f4dc918b1bc005149c50abb3d54d66ed3047.tar.xz
m_property: add `>` for fixed precision floating-point expansion
This enhancement makes it easier to create constant width property expansions, useful for the `--term-status-msg`. Additionally, it changes to `%f` printing with manual zero trimming, which is easier to control than `%g`. With this method, we can directly specify precision, not just significant numbers. This approach also avoids overly high precision for values less than 1, which is not necessary for a generic floating-point print function. A new print helper function is added, which can be used with adjusted precision for specific cases where a different default is needed. This also unifies the code slightly.
Diffstat (limited to 'DOCS/man/input.rst')
-rw-r--r--DOCS/man/input.rst8
1 files changed, 7 insertions, 1 deletions
diff --git a/DOCS/man/input.rst b/DOCS/man/input.rst
index bb353cd117..341d20c926 100644
--- a/DOCS/man/input.rst
+++ b/DOCS/man/input.rst
@@ -3766,7 +3766,9 @@ Normally, properties are formatted as human-readable text, meant to be
displayed on OSD or on the terminal. It is possible to retrieve an unformatted
(raw) value from a property by prefixing its name with ``=``. These raw values
can be parsed by other programs and follow the same conventions as the options
-associated with the properties.
+associated with the properties. Additionally, there is a ``>`` prefix to format
+human-readable text, with fixed precision for floating-point values. This is
+useful for printing values where a constant width is important.
.. admonition:: Examples
@@ -3775,6 +3777,10 @@ associated with the properties.
- ``${=time-pos}`` expands to ``863.4`` (same time, plus 400 milliseconds -
milliseconds are normally not shown in the formatted case)
+ - ``${avsync}`` expands to ``+0.003``
+ - ``${>avsync}`` expands to ``+0.0030``
+ - ``${=avsync}`` expands to ``0.003028``
+
Sometimes, the difference in amount of information carried by raw and formatted
property values can be rather big. In some cases, raw values have more
information, like higher precision than seconds with ``time-pos``. Sometimes