Skip to content

Commit

Permalink
screen_utils: skip items which are at a deeper level
Browse files Browse the repository at this point in the history
Since the clear() call was removed, the given range may contain items
which are at a deeper directory level, but we should only show those
at the current level.
  • Loading branch information
MaxKellermann committed Sep 12, 2024
1 parent 8b6a7cf commit f3c7c5b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/screen_utils.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ screen_display_completion_list(ScreenManager &screen,
SelectStyle(window, Style::STATUS_ALERT);

auto i = std::next(range.begin(), offset);
for (unsigned y = 0; y < height; ++y, ++i) {
for (unsigned y = 0; y < height; ++i) {
window.MoveCursor({0, (int)y});
if (i == range.end())
break;
Expand All @@ -61,8 +61,15 @@ screen_display_completion_list(ScreenManager &screen,
directory" */
s = "."sv;

if (const auto slash = s.find('/');
slash != s.npos && slash + 1 < s.size())
/* this item is from a deeper directory level:
skip it */
continue;

window.String(s);
window.ClearToEol();
++y;
}

window.ClearToBottom();
Expand Down

0 comments on commit f3c7c5b

Please sign in to comment.