Skip to content

Commit

Permalink
screen_utils: remove CompletionDisplayString()
Browse files Browse the repository at this point in the history
The logic of CompletionDisplayString() was obsoleted by the previous commit.
  • Loading branch information
MaxKellermann committed Sep 12, 2024
1 parent 11e2ebe commit 3da23e8
Showing 1 changed file with 1 addition and 25 deletions.
26 changes: 1 addition & 25 deletions src/screen_utils.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,6 @@

using std::string_view_literals::operator""sv;

static std::string_view
CompletionDisplayString(std::string_view value) noexcept
{
if (value.ends_with('/')) {
/* if the string ends with a slash (directory URIs
usually do), backtrack to the preceding slash (if
any) */

if (value.size() > 2) {
if (const auto slash = value.rfind('/', value.size() - 2);
slash != value.npos)
value = value.substr(slash + 1);
}

return value;
} else {
if (const auto slash = value.rfind('/');
slash != value.npos)
value = value.substr(slash);

return value;
}
}

void
screen_display_completion_list(ScreenManager &screen,
std::string_view prefix,
Expand Down Expand Up @@ -78,7 +54,7 @@ screen_display_completion_list(ScreenManager &screen,

s = s.substr(prefix.size());

window.String(CompletionDisplayString(s));
window.String(s);
window.ClearToEol();
}

Expand Down

0 comments on commit 3da23e8

Please sign in to comment.