Due to a recent change in mpv writing to playlist-pos doesn't restart
playback anymore, which was necessary for the format change to work for
the current file.
4b2276b730
mpv is about to remove `shared-script-properties`, which will cause
`utils.shared_script_property_set` to be nil.
Check for it's existence before calling it.
* feat: make the menu searchable
Each menu/submenu can have a `on_search` and `search_debounce`.
`search_debounce` supports the special value 'submit' with which
searches only get executed upon pressing ctrl+enter.
Without a `on_search` an internal search implementation gets used.
The internal search has it's own menu update function that is needed to
keep the same menu item objects around because otherwise updates to
children get discarded when the parent search gets updated.
* feat: add `menu_type_to_search` option
Always listening to text breaks toggling the menu via a single keybind.
Add an option so users can choose to manually activate the search.
It attempts to do what select_by_offset already does but worse and
the check also couldn't have been right.
Additionally select_by_offset() was missing a request_render(), but that
seems to never actually make a difference.
A speed control diffinition like e.g. `speed:{1.8}` would result in
a crash because the `scale` gets set to `{1.8}` which isn't a string
lua can convert to a number on the fly.
Fixes#632
Options can be changed during runtime by changing `script-opts`.
So far such option changes were simply ignored.
Now most options work, and the rest can be implemented when the needed.
It was possible for not selectable items to be selected via page up/down
as well as when updating the menu.
Page down now goes to the next best selectable item after adding to the
index, like is the case for next(), with a fallback to an earlier index.
Page up is the same as page down but inverted direction.
Updating the menu now chooses the closes selectable item to the intended
index.
* refactor: unify menu item navigation
The menu item representing an empty menu is supposed to be not
selectable, however it was possible to select it with the mouse.
That results in a crash in the chapters menu because it subtracts one
from the value, which is "ignore" for the "Empty" item.
Circular buffers are more efficient then moving the entries around.
Cursor velocity is now calculated on the fly, with from the current
cursor position and time as well a cursor position that is either
the youngest sample >100ms old, or the oldest sample in the buffer,
which is 10 elements in size. Restricting the sample selection based on
time prevents the filter window from becomming too long in case of
setups with low cursor update frequency, while still bring more
responsive velocity measurements to systems with higher cursor update
frequencies.
Removed the timer for exact seeking after fast seeks, as fast/exact
seeks can now be controlled with cursor speed and thus there is no need
for this anymore.
We were already using the same sorting algorithm as autoload.lua,
but with the addition of a custom symbol order. However that symbol
order was only applied to the first character, so when sorting absolute
paths it doesn't actually make a difference.
Using the exact same algorithm for autoload.lua and uosc also makes it
easier to apply any future improvements from one to the other.
- Left side of the empty menu screen is no longer a huge invisible back button. Instead, each parent menu can be clicked individually to navigate to it. Clicking empty space now correctly closes the menu.
- Submenus can now also be clicked to navigate to them.
- Moving cursor towards a submenu will not cause other items in current menu to be selected if cursor moves through them.
ref #217