diff options
| author | Ulf Magnusson <ulfalizer@gmail.com> | 2019-04-03 07:12:38 +0200 |
|---|---|---|
| committer | Ulf Magnusson <ulfalizer@gmail.com> | 2019-04-03 07:13:24 +0200 |
| commit | d2d52b7cab80e440cda7addbad23e06dc91494a4 (patch) | |
| tree | a6fce8365f75e4cdc4055791e61b4213ee0484ad | |
| parent | 68ffa81887f7fab2dd9fdb05130074efc2ca05ce (diff) | |
menuconfig: Simplify show-all backwards search
Roll the reversing into the slice.
| -rwxr-xr-x | menuconfig.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/menuconfig.py b/menuconfig.py index 9ea31cb..7745800 100755 --- a/menuconfig.py +++ b/menuconfig.py @@ -1254,10 +1254,9 @@ def _toggle_show_all(): # Find a good node to select. The selected node might disappear if show-all # mode is turned off. - # If there are visible nodes before the previously selected node, select - # the closest one. This will select the previously selected node itself if - # it is still visible. - for node in reversed(_shown[:_sel_node_i + 1]): + # Select the previously selected node itself if it is still visible. If + # there are visible nodes before it, select the closest one. + for node in _shown[_sel_node_i::-1]: if node in new_shown: _sel_node_i = new_shown.index(node) break |
