mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
i18n
- Added function utf8_text_length which calculates the length of text in characters, not bytes, and excludes color control codes.
This commit is contained in:
parent
46b799a5b7
commit
291818c33d
3 changed files with 42 additions and 3 deletions
|
@ -254,7 +254,7 @@ void extractLine (std::string& text, std::string& line, int length)
|
|||
|
||||
// Special case: no \n, and less than length characters total.
|
||||
// special case: text.find ("\n") == std::string::npos && text.length () < length
|
||||
if (eol == std::string::npos && utf8_length (text) <= length)
|
||||
if (eol == std::string::npos && utf8_text_length (text) <= length)
|
||||
{
|
||||
line = text;
|
||||
text = "";
|
||||
|
@ -730,7 +730,7 @@ std::string leftJustify (const int input, const int width)
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
std::string leftJustify (const std::string& input, const int width)
|
||||
{
|
||||
return input + std::string (width - utf8_length (input), ' ');
|
||||
return input + std::string (width - utf8_text_length (input), ' ');
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -744,7 +744,7 @@ std::string rightJustify (const int input, const int width)
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
std::string rightJustify (const std::string& input, const int width)
|
||||
{
|
||||
return std::string (width - utf8_length (input), ' ') + input;
|
||||
return std::string (width - utf8_text_length (input), ' ') + input;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue