mirror of
https://github.com/mawww/kakoune.git
synced 2024-12-29 14:44:56 +03:00
Replace tab characters with spaces in info/echo
This is tricky to fix better than that as tabs make text length dependent on where it will get displayed and what preceedes it. Also fix an issue with empty info title Fixes #2237
This commit is contained in:
parent
34f48cc851
commit
6fd486c65e
@ -425,9 +425,9 @@ void Client::info_show(StringView title, StringView content, BufferCoord anchor,
|
||||
{
|
||||
if (not content.empty() and content.back() == '\n')
|
||||
content = content.substr(0, content.length() - 1);
|
||||
info_show({title.str(), Face{}},
|
||||
info_show(title.empty() ? DisplayLine{} : DisplayLine{title.str(), Face{}},
|
||||
content | split<StringView>('\n')
|
||||
| transform([](StringView s) { return DisplayLine{s.str(), Face{}}; })
|
||||
| transform([](StringView s) { return DisplayLine{replace(s, '\t', ' '), Face{}}; })
|
||||
| gather<DisplayLineList>(),
|
||||
anchor, style);
|
||||
}
|
||||
|
@ -1277,7 +1277,7 @@ const CommandDesc echo_cmd = {
|
||||
else if (parser.get_switch("markup"))
|
||||
context.print_status(parse_display_line(message, context.faces()));
|
||||
else
|
||||
context.print_status({ std::move(message), context.faces()["StatusLine"] });
|
||||
context.print_status({replace(message, '\t', ' '), context.faces()["StatusLine"]});
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -286,7 +286,7 @@ DisplayLine parse_display_line(StringView line, const FaceRegistry& faces, const
|
||||
pos = closing + 1;
|
||||
}
|
||||
}
|
||||
if (c == '\n') // line breaks are forbidden, replace with space
|
||||
if (c == '\n' or c == '\t') // line breaks and tabs are forbidden, replace with space
|
||||
{
|
||||
content += StringView{pos, it+1};
|
||||
content.back() = ' ';
|
||||
|
Loading…
Reference in New Issue
Block a user