davatorium / rofi

Rofi: A window switcher, application launcher and dmenu replacement
https://davatorium.github.io/rofi/
Other
13.33k stars 614 forks source link

[BUG] `new-selection` not working for values exceeding the number of rows of previous run #2037

Open neunato opened 1 month ago

neunato commented 1 month ago

Rofi version (rofi -v)

1.7.5

Configuration

https://gist.github.com/neunato/d652537be9964c1517979af937e49889

Theme

https://gist.github.com/neunato/4b593b7b9df80c50387d1f2ba575c996

Timing report

https://gist.github.com/neunato/074b317a1292d9af057a8b8221443ef8

Launch command

rofi -show test -modes test:./script.sh

Step to reproduce

Create a new file script.sh with the following contents:

#!/bin/bash

echo -e "\0keep-selection\x1ftrue"

if [[ -z $1 || $1 == "back" ]]; then
   echo -e "\0new-selection\x1f3"
   echo "forth"
   echo "forth"
   echo "forth"
   echo "forth"
else
   echo -e "\0new-selection\x1f2"
   echo "back"
   echo "back"
   echo "back"
fi

Launch rofi

rofi -show test -modes test:./script.sh

Press enter twice

Expected behavior

The last row is selected whenever the entries are updated.

https://github.com/user-attachments/assets/8ecd0026-6734-4118-81a6-f99de2c1d05d

Actual behavior

The first row is selected when menu updated from 3 to 4 rows. The other direction works.

https://github.com/user-attachments/assets/36da9890-8cc1-4f7f-b943-cc2827cd7795

Additional information

Selecting the first/second/third row in the four-row menu works. Selecting any number larger than the previous menu size results in the first row being selected, even if the updated menu has enough rows.

Using wayland display server protocol

I've checked if the issue exists in the latest stable release

DaveDavenport commented 1 month ago

Yep, good catch.. Going to a bit tricky one to fix :smile:

DaveDavenport commented 1 month ago

This is going to require some rewriting of parts, so moving it to one later release to fix regrettable.

neunato commented 1 month ago

That's unfortunate but I don't mind as this patch solved my issues.

Surely something else is now broken, but I don't seem to be using it as all my menus work :)

DaveDavenport commented 1 month ago

Yes, that patch breaks some functionality.