subseq: Score matches with dynamic programming

score_item tried every combination of positions of the needle chars in the
item, which is exponential in the length of the query. Typing the full name
of a theme like "Solarized Dark Higher Contrast" in the themes kitten froze it
for about half a minute.

Instead find the best score for each position of each needle char from the
best scores for the previous char. The per char scores are added in the same
order as before, so the scores are bit for bit identical. When several sets
of positions have exactly the same score, the highlighted positions can be
different from before.
This commit is contained in:
Artem Lytkin 2026-09-25 16:46:19 +03:00
parent c7d4eab814
commit ef1c0fd416
3 changed files with 154 additions and 64 deletions

View file

@ -213,6 +213,9 @@ Detailed list of changes
- Vertical tabs: Improve rendering of tabs when using the ``powerline`` :opt:`tab_bar_style`
- themes and choose fonts kittens: Fix search freezing for many seconds when
typing a long query, such as the full name of a theme
0.49.1 [2026-09-24]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~