Commit 974b0a3
committed
[View] Apply a requested selection after the reload that carries it
rofi_view_set_selected_line() resolves the line against line_map, which only
describes content the view has already loaded. A mode that reloads and selects
in one go cannot satisfy that: rofi_view_reload() arms the backend's reload
timer, and line_map is rebuilt later, in rofi_view_refilter_real(). The lookup
therefore ran against the previous list and fell back to row 0 whenever the
requested line was out of its range, leaving rofi_view_get_selected_line() and
listview_get_selected() disagreeing.
Record such a request in state->pending_selected_line instead of falling back to
row 0, and apply it in refilter, in the same pass that installs the new content
and before it repaints, so no frame shows the wrong row. Requests are one-shot
and honoured only on the reload path: state->selected_line is stale between
activations, so re-applying it on an ordinary refilter would move the selection
away from where the user left it.
Script mode's keep-selection is affected: it bounds-checks new-selection against
the new list length, then resolves it against the old line_map.1 parent 108f494 commit 974b0a3
2 files changed
Lines changed: 49 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
104 | 107 | | |
105 | 108 | | |
106 | 109 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
344 | 344 | | |
345 | 345 | | |
346 | 346 | | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
347 | 368 | | |
348 | 369 | | |
349 | 370 | | |
350 | | - | |
351 | | - | |
352 | | - | |
353 | | - | |
354 | | - | |
355 | | - | |
356 | | - | |
357 | | - | |
358 | | - | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
359 | 378 | | |
360 | | - | |
361 | 379 | | |
362 | 380 | | |
363 | 381 | | |
| |||
419 | 437 | | |
420 | 438 | | |
421 | 439 | | |
422 | | - | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
423 | 444 | | |
424 | 445 | | |
425 | 446 | | |
| |||
784 | 805 | | |
785 | 806 | | |
786 | 807 | | |
| 808 | + | |
787 | 809 | | |
788 | 810 | | |
789 | 811 | | |
| 812 | + | |
790 | 813 | | |
791 | 814 | | |
792 | 815 | | |
| |||
882 | 905 | | |
883 | 906 | | |
884 | 907 | | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
885 | 920 | | |
886 | 921 | | |
887 | 922 | | |
| |||
0 commit comments