From d2d52b7cab80e440cda7addbad23e06dc91494a4 Mon Sep 17 00:00:00 2001 From: Ulf Magnusson Date: Wed, 3 Apr 2019 07:12:38 +0200 Subject: menuconfig: Simplify show-all backwards search Roll the reversing into the slice. --- menuconfig.py | 7 +++---- 1 file 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 -- cgit v1.2.3