Fix remove of highlighters with trailing / in their name

Fixes #1914
This commit is contained in:
Maxime Coste 2018-03-20 05:35:37 +11:00
parent 56237aa8f8
commit 826977eb1b

View File

@ -742,6 +742,9 @@ const CommandDesc remove_highlighter_cmd = {
[](const ParametersParser& parser, Context& context, const ShellContext&)
{
StringView path = parser[0];
if (not path.empty() and path.back() == '/') // ignore trailing /
path = path.substr(0_byte, path.length() - 1_byte);
auto rev_path = path | reverse();
auto sep_it = find(rev_path, '/');
if (sep_it == rev_path.end())