mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-23 04:46:55 +03:00
lib/strutil/strutilutf8.c: grammar.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
eef076cef6
commit
2d77cb32f9
@ -44,7 +44,7 @@ struct utf8_tool
|
|||||||
{
|
{
|
||||||
char *actual;
|
char *actual;
|
||||||
size_t remain;
|
size_t remain;
|
||||||
const char *cheked;
|
const char *checked;
|
||||||
int ident;
|
int ident;
|
||||||
gboolean compose;
|
gboolean compose;
|
||||||
};
|
};
|
||||||
@ -538,12 +538,12 @@ utf8_tool_copy_chars_to_end (struct utf8_tool *tool)
|
|||||||
{
|
{
|
||||||
tool->compose = FALSE;
|
tool->compose = FALSE;
|
||||||
|
|
||||||
while (tool->cheked[0] != '\0')
|
while (tool->checked[0] != '\0')
|
||||||
{
|
{
|
||||||
gunichar uni;
|
gunichar uni;
|
||||||
size_t left;
|
size_t left;
|
||||||
|
|
||||||
uni = g_utf8_get_char (tool->cheked);
|
uni = g_utf8_get_char (tool->checked);
|
||||||
tool->compose = tool->compose || str_unichar_iscombiningmark (uni);
|
tool->compose = tool->compose || str_unichar_iscombiningmark (uni);
|
||||||
left = g_unichar_to_utf8 (uni, NULL);
|
left = g_unichar_to_utf8 (uni, NULL);
|
||||||
if (tool->remain <= left)
|
if (tool->remain <= left)
|
||||||
@ -551,7 +551,7 @@ utf8_tool_copy_chars_to_end (struct utf8_tool *tool)
|
|||||||
left = g_unichar_to_utf8 (uni, tool->actual);
|
left = g_unichar_to_utf8 (uni, tool->actual);
|
||||||
tool->actual += left;
|
tool->actual += left;
|
||||||
tool->remain -= left;
|
tool->remain -= left;
|
||||||
tool->cheked = g_utf8_next_char (tool->cheked);
|
tool->checked = g_utf8_next_char (tool->checked);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -566,13 +566,13 @@ utf8_tool_copy_chars_to (struct utf8_tool *tool, int to_ident)
|
|||||||
{
|
{
|
||||||
tool->compose = FALSE;
|
tool->compose = FALSE;
|
||||||
|
|
||||||
while (tool->cheked[0] != '\0')
|
while (tool->checked[0] != '\0')
|
||||||
{
|
{
|
||||||
gunichar uni;
|
gunichar uni;
|
||||||
size_t left;
|
size_t left;
|
||||||
int w = 0;
|
int w = 0;
|
||||||
|
|
||||||
uni = g_utf8_get_char (tool->cheked);
|
uni = g_utf8_get_char (tool->checked);
|
||||||
if (str_unichar_iscombiningmark (uni))
|
if (str_unichar_iscombiningmark (uni))
|
||||||
tool->compose = TRUE;
|
tool->compose = TRUE;
|
||||||
else
|
else
|
||||||
@ -590,7 +590,7 @@ utf8_tool_copy_chars_to (struct utf8_tool *tool, int to_ident)
|
|||||||
left = g_unichar_to_utf8 (uni, tool->actual);
|
left = g_unichar_to_utf8 (uni, tool->actual);
|
||||||
tool->actual += left;
|
tool->actual += left;
|
||||||
tool->remain -= left;
|
tool->remain -= left;
|
||||||
tool->cheked = g_utf8_next_char (tool->cheked);
|
tool->checked = g_utf8_next_char (tool->checked);
|
||||||
tool->ident += w;
|
tool->ident += w;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -638,23 +638,23 @@ utf8_tool_skip_chars_to (struct utf8_tool *tool, int to_ident)
|
|||||||
{
|
{
|
||||||
gunichar uni;
|
gunichar uni;
|
||||||
|
|
||||||
while (to_ident > tool->ident && tool->cheked[0] != '\0')
|
while (to_ident > tool->ident && tool->checked[0] != '\0')
|
||||||
{
|
{
|
||||||
uni = g_utf8_get_char (tool->cheked);
|
uni = g_utf8_get_char (tool->checked);
|
||||||
if (!str_unichar_iscombiningmark (uni))
|
if (!str_unichar_iscombiningmark (uni))
|
||||||
{
|
{
|
||||||
tool->ident++;
|
tool->ident++;
|
||||||
if (g_unichar_iswide (uni))
|
if (g_unichar_iswide (uni))
|
||||||
tool->ident++;
|
tool->ident++;
|
||||||
}
|
}
|
||||||
tool->cheked = g_utf8_next_char (tool->cheked);
|
tool->checked = g_utf8_next_char (tool->checked);
|
||||||
}
|
}
|
||||||
|
|
||||||
uni = g_utf8_get_char (tool->cheked);
|
uni = g_utf8_get_char (tool->checked);
|
||||||
while (str_unichar_iscombiningmark (uni))
|
while (str_unichar_iscombiningmark (uni))
|
||||||
{
|
{
|
||||||
tool->cheked = g_utf8_next_char (tool->cheked);
|
tool->checked = g_utf8_next_char (tool->checked);
|
||||||
uni = g_utf8_get_char (tool->cheked);
|
uni = g_utf8_get_char (tool->checked);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -682,7 +682,7 @@ str_utf8_fit_to_term (const char *text, int width, align_crt_t just_mode)
|
|||||||
struct utf8_tool tool;
|
struct utf8_tool tool;
|
||||||
|
|
||||||
pre_form = str_utf8_make_make_term_form (text, (size_t) (-1));
|
pre_form = str_utf8_make_make_term_form (text, (size_t) (-1));
|
||||||
tool.cheked = pre_form->text;
|
tool.checked = pre_form->text;
|
||||||
tool.actual = result;
|
tool.actual = result;
|
||||||
tool.remain = sizeof (result);
|
tool.remain = sizeof (result);
|
||||||
tool.compose = FALSE;
|
tool.compose = FALSE;
|
||||||
@ -762,7 +762,7 @@ str_utf8_term_trim (const char *text, int width)
|
|||||||
|
|
||||||
pre_form = str_utf8_make_make_term_form (text, (size_t) (-1));
|
pre_form = str_utf8_make_make_term_form (text, (size_t) (-1));
|
||||||
|
|
||||||
tool.cheked = pre_form->text;
|
tool.checked = pre_form->text;
|
||||||
tool.actual = result;
|
tool.actual = result;
|
||||||
tool.remain = sizeof (result);
|
tool.remain = sizeof (result);
|
||||||
tool.compose = FALSE;
|
tool.compose = FALSE;
|
||||||
@ -833,7 +833,7 @@ str_utf8_term_substring (const char *text, int start, int width)
|
|||||||
|
|
||||||
pre_form = str_utf8_make_make_term_form (text, (size_t) (-1));
|
pre_form = str_utf8_make_make_term_form (text, (size_t) (-1));
|
||||||
|
|
||||||
tool.cheked = pre_form->text;
|
tool.checked = pre_form->text;
|
||||||
tool.actual = result;
|
tool.actual = result;
|
||||||
tool.remain = sizeof (result);
|
tool.remain = sizeof (result);
|
||||||
tool.compose = FALSE;
|
tool.compose = FALSE;
|
||||||
@ -864,7 +864,7 @@ str_utf8_trunc (const char *text, int width)
|
|||||||
|
|
||||||
pre_form = str_utf8_make_make_term_form (text, (size_t) (-1));
|
pre_form = str_utf8_make_make_term_form (text, (size_t) (-1));
|
||||||
|
|
||||||
tool.cheked = pre_form->text;
|
tool.checked = pre_form->text;
|
||||||
tool.actual = result;
|
tool.actual = result;
|
||||||
tool.remain = sizeof (result);
|
tool.remain = sizeof (result);
|
||||||
tool.compose = FALSE;
|
tool.compose = FALSE;
|
||||||
|
Loading…
Reference in New Issue
Block a user