Skip to content

Commit

Permalink
screen_utils: show current directory as "."
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxKellermann committed Sep 12, 2024
1 parent 3da23e8 commit 8b6a7cf
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 @@ -52,7 +52,14 @@ screen_display_completion_list(ScreenManager &screen,
std::string_view s = *i;
assert(s.size() >= prefix.size());

s = s.substr(prefix.size());
if (s.size() > prefix.size())
/* strip the prefix */
s = s.substr(prefix.size());
else
/* if the prefix equals this item, use this
special string which means "current
directory" */
s = "."sv;

window.String(s);
window.ClearToEol();
Expand Down

0 comments on commit 8b6a7cf

Please sign in to comment.