mirror of
https://github.com/anope/anope.git
synced 2026-06-26 15:16:38 +02:00
Vendor utfcpp, use to fix alignment for non-ascii syntax messages.
This commit is contained in:
+4
-1
@@ -17,6 +17,8 @@
|
||||
#include "regchannel.h"
|
||||
#include "channels.h"
|
||||
|
||||
#include "utfcpp/unchecked.h"
|
||||
|
||||
void CommandReply::SendMessage(CommandSource &source, const Anope::string &msg)
|
||||
{
|
||||
SendMessage(source.service, msg);
|
||||
@@ -150,6 +152,7 @@ void Command::SendSyntax(CommandSource &source)
|
||||
{
|
||||
auto first = true;
|
||||
Anope::string prefix = Language::Translate(source.GetAccount(), _("Syntax"));
|
||||
Anope::string padding(utf8::unchecked::distance(prefix.str().begin(), prefix.str().end()), ' ');
|
||||
for (const auto &[syntax, predicate] : this->syntax)
|
||||
{
|
||||
if (predicate && !predicate(source))
|
||||
@@ -163,7 +166,7 @@ void Command::SendSyntax(CommandSource &source)
|
||||
}
|
||||
else
|
||||
{
|
||||
source.Reply("%-*s \002%s %s\002", (int)prefix.length(), "", source.command.nobreak().c_str(),
|
||||
source.Reply("%s \002%s %s\002", padding.c_str(), source.command.nobreak().c_str(),
|
||||
Language::Translate(source.GetAccount(), syntax.c_str()));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user