mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
UTF8: Moved variable into lower scope
This commit is contained in:
parent
5b01abc27f
commit
21dc2ec100
1 changed files with 1 additions and 4 deletions
|
@ -188,20 +188,17 @@ unsigned int utf8_length (const std::string& str)
|
||||||
unsigned int utf8_width (const std::string& str)
|
unsigned int utf8_width (const std::string& str)
|
||||||
{
|
{
|
||||||
unsigned int length = 0;
|
unsigned int length = 0;
|
||||||
int l;
|
|
||||||
std::string::size_type i = 0;
|
std::string::size_type i = 0;
|
||||||
unsigned int c;
|
unsigned int c;
|
||||||
while ((c = utf8_next_char (str, i)))
|
while ((c = utf8_next_char (str, i)))
|
||||||
{
|
{
|
||||||
l = mk_wcwidth (c);
|
|
||||||
// Control characters, and more especially newline characters, make
|
// Control characters, and more especially newline characters, make
|
||||||
// mk_wcwidth() return -1. Ignore that, thereby "adding zero" to length.
|
// mk_wcwidth() return -1. Ignore that, thereby "adding zero" to length.
|
||||||
// Since control characters are not displayed in reports, this is a valid
|
// Since control characters are not displayed in reports, this is a valid
|
||||||
// choice.
|
// choice.
|
||||||
|
int l = mk_wcwidth (c);
|
||||||
if (l != -1)
|
if (l != -1)
|
||||||
{
|
|
||||||
length += l;
|
length += l;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return length;
|
return length;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue