mirror of
https://github.com/rkd77/elinks.git
synced 2025-02-02 15:09:23 -05:00
Change "utf_8" to "utf8" in most identifiers.
Suggested by Miciah on #elinks. What was renamed: add_utf_8 => add_utf8 cp2utf_8 => cp2utf8 encode_utf_8 => encode_utf8 get_translation_table_to_utf_8 => get_translation_table_to_utf8 goto invalid_utf_8_start_byte => goto invalid_utf8_start_byte goto utf_8 => goto utf8 goto utf_8_select => goto utf8_select terminal_interlink.utf_8 => terminal_interlink.utf8 utf_8_to_unicode => utf8_to_unicode What was not renamed: terminal._template_.utf_8_io option, TERM_OPT_UTF_8_IO Compatibility with existing elinks.conf files would require an alias. --enable-utf-8 Because the name of the charset is UTF-8, --enable-utf-8 looks better than --enable-utf8. CONFIG_UTF_8 Will be renamed in a later commit. Unicode/utf_8.cp, table_utf_8, aliases_utf_8 Will be renamed in a later commit.
This commit is contained in:
parent
b42f0ba153
commit
e8462980e5
@ -478,7 +478,7 @@ kbd_field(struct dialog_data *dlg_data, struct widget_data *widget_data)
|
||||
unsigned char *next = widget_data->cdata + widget_data->info.field.cpos;
|
||||
unsigned char *end = strchr(next, '\0');
|
||||
|
||||
utf_8_to_unicode(&next, end);
|
||||
utf8_to_unicode(&next, end);
|
||||
widget_data->info.field.cpos = (int)(next - widget_data->cdata);
|
||||
} else
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
@ -528,7 +528,7 @@ kbd_field(struct dialog_data *dlg_data, struct widget_data *widget_data)
|
||||
int old = widget_data->info.field.cpos;
|
||||
|
||||
while(1) {
|
||||
data = utf_8_to_unicode(&text, end);
|
||||
data = utf8_to_unicode(&text, end);
|
||||
if (data == UCS_NO_CHAR)
|
||||
break;
|
||||
}
|
||||
@ -564,7 +564,7 @@ kbd_field(struct dialog_data *dlg_data, struct widget_data *widget_data)
|
||||
unsigned char *text = widget_data->cdata + widget_data->info.field.cpos;
|
||||
unsigned char *old = text;
|
||||
|
||||
utf_8_to_unicode(&text, end);
|
||||
utf8_to_unicode(&text, end);
|
||||
if (old != text) {
|
||||
memmove(old, text,
|
||||
(int)(end - text) + 1);
|
||||
@ -681,7 +681,7 @@ kbd_field(struct dialog_data *dlg_data, struct widget_data *widget_data)
|
||||
unsigned char *text = widget_data->cdata;
|
||||
int textlen = strlen(text);
|
||||
#ifdef CONFIG_UTF_8
|
||||
const unsigned char *ins = encode_utf_8(get_kbd_key(ev));
|
||||
const unsigned char *ins = encode_utf8(get_kbd_key(ev));
|
||||
int inslen = utf8charlen(ins);
|
||||
#else /* !CONFIG_UTF_8 */
|
||||
const int inslen = 1;
|
||||
|
@ -461,7 +461,7 @@ utf8:
|
||||
for (x = 0; x - !!hk_state < w && *text2; x++) {
|
||||
unicode_val_T data;
|
||||
|
||||
data = utf_8_to_unicode(&text2, end);
|
||||
data = utf8_to_unicode(&text2, end);
|
||||
if (!hk_state && (int)(text2 - text) == hotkey_pos) {
|
||||
hk_state = 1;
|
||||
continue;
|
||||
|
@ -311,7 +311,7 @@ render_dom_line(struct dom_renderer *renderer, struct screen_char *template,
|
||||
if (utf8) {
|
||||
unicode_val_T data;
|
||||
charlen = utf8charlen(text);
|
||||
data = utf_8_to_unicode(&text, end);
|
||||
data = utf8_to_unicode(&text, end);
|
||||
|
||||
template->data = (unicode_val_T)data;
|
||||
|
||||
|
@ -422,7 +422,7 @@ set_hline(struct html_context *html_context, unsigned char *chars, int charslen,
|
||||
}
|
||||
part->document->buf_length = i;
|
||||
part->document->buf[i] = '\0';
|
||||
data = utf_8_to_unicode(&buf_ptr, buf_ptr + i);
|
||||
data = utf8_to_unicode(&buf_ptr, buf_ptr + i);
|
||||
if (data != UCS_NO_CHAR) {
|
||||
part->document->buf_length = 0;
|
||||
goto good_char;
|
||||
@ -440,7 +440,7 @@ set_hline(struct html_context *html_context, unsigned char *chars, int charslen,
|
||||
chars++;
|
||||
} else {
|
||||
part->spaces[x] = (*chars == ' ');
|
||||
data = utf_8_to_unicode(&chars, end);
|
||||
data = utf8_to_unicode(&chars, end);
|
||||
if (data == UCS_NO_CHAR) {
|
||||
if (charslen == 1) {
|
||||
/* HR */
|
||||
@ -467,7 +467,7 @@ good_char:
|
||||
schar->data = (unicode_val_T)data;
|
||||
part->char_width[x] = 2;
|
||||
copy_screen_chars(&POS(x++, y), schar, 1);
|
||||
data = utf_8_to_unicode(&chars, end);
|
||||
data = utf8_to_unicode(&chars, end);
|
||||
if (data == UCS_NO_CHAR) goto broken_char;
|
||||
schar->data = (unicode_val_T)data;
|
||||
part->spaces[x] = 0;
|
||||
@ -503,13 +503,13 @@ good_char:
|
||||
unicode_val_T data;
|
||||
|
||||
part->spaces[x] = (*chars == ' ');
|
||||
data = utf_8_to_unicode(&chars, end);
|
||||
data = utf8_to_unicode(&chars, end);
|
||||
part->char_width[x] = unicode_to_cell(data);
|
||||
if (part->char_width[x] == 2) {
|
||||
x++;
|
||||
part->spaces[x] = 0;
|
||||
part->char_width[x] = 0;
|
||||
data = utf_8_to_unicode(&chars, end);
|
||||
data = utf8_to_unicode(&chars, end);
|
||||
}
|
||||
if (data == UCS_NO_CHAR) {
|
||||
/* this is at the end only */
|
||||
|
@ -259,7 +259,7 @@ add_document_line(struct plain_renderer *renderer,
|
||||
if (utf8) {
|
||||
unsigned char *line_char2 = &line[line_pos];
|
||||
charlen = utf8charlen(&line_char);
|
||||
data = utf_8_to_unicode(&line_char2, &line[width]);
|
||||
data = utf8_to_unicode(&line_char2, &line[width]);
|
||||
|
||||
if (data == UCS_NO_CHAR) {
|
||||
line_pos += charlen;
|
||||
@ -319,7 +319,7 @@ add_document_line(struct plain_renderer *renderer,
|
||||
if (utf8) {
|
||||
unsigned char *line_char2 = &line[line_pos];
|
||||
charlen = utf8charlen(&line_char);
|
||||
data = utf_8_to_unicode(&line_char2, &line[width]);
|
||||
data = utf8_to_unicode(&line_char2, &line[width]);
|
||||
|
||||
if (data == UCS_NO_CHAR) {
|
||||
line_pos += charlen;
|
||||
@ -437,7 +437,7 @@ add_document_line(struct plain_renderer *renderer,
|
||||
if (utf8) {
|
||||
unsigned char *text = &line[line_pos];
|
||||
unicode_val_T data =
|
||||
utf_8_to_unicode(&text,
|
||||
utf8_to_unicode(&text,
|
||||
&line[width]);
|
||||
|
||||
if (data == UCS_NO_CHAR) {
|
||||
@ -555,7 +555,7 @@ add_document_lines(struct plain_renderer *renderer)
|
||||
#ifdef CONFIG_UTF_8
|
||||
if (utf8) {
|
||||
unsigned char *text = &source[width];
|
||||
unicode_val_T data = utf_8_to_unicode(&text,
|
||||
unicode_val_T data = utf8_to_unicode(&text,
|
||||
&source[length]);
|
||||
|
||||
if (data == UCS_NO_CHAR) return;
|
||||
|
@ -148,7 +148,7 @@ u2cp_(unicode_val_T u, int to, int no_nbsp_hack)
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
if (codepages[to].table == table_utf_8)
|
||||
return encode_utf_8(u);
|
||||
return encode_utf8(u);
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
|
||||
/* To mark non breaking spaces, we use a special char NBSP_CHAR. */
|
||||
@ -177,10 +177,10 @@ static unsigned char utf_buffer[7];
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
inline unsigned char *
|
||||
encode_utf_8(unicode_val_T u)
|
||||
encode_utf8(unicode_val_T u)
|
||||
#else
|
||||
static unsigned char *
|
||||
encode_utf_8(unicode_val_T u)
|
||||
encode_utf8(unicode_val_T u)
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
{
|
||||
memset(utf_buffer, 0, 7);
|
||||
@ -281,7 +281,7 @@ utf8_char2cells(unsigned char *utf8_char, unsigned char *end)
|
||||
if(!utf8_char || !end)
|
||||
return -1;
|
||||
|
||||
u = utf_8_to_unicode(&utf8_char, end);
|
||||
u = utf8_to_unicode(&utf8_char, end);
|
||||
|
||||
return unicode_to_cell(u);
|
||||
}
|
||||
@ -415,7 +415,7 @@ utf8_step_forward(unsigned char *string, unsigned char *end,
|
||||
unsigned char *prev = current;
|
||||
int width;
|
||||
|
||||
u = utf_8_to_unicode(¤t, end);
|
||||
u = utf8_to_unicode(¤t, end);
|
||||
if (u == UCS_NO_CHAR) {
|
||||
/* Assume the incomplete sequence
|
||||
* costs one cell. */
|
||||
@ -490,7 +490,7 @@ utf8_step_backward(unsigned char *string, unsigned char *start,
|
||||
} while (current > start && !utf8_islead(*current));
|
||||
|
||||
look = current;
|
||||
u = utf_8_to_unicode(&look, prev);
|
||||
u = utf8_to_unicode(&look, prev);
|
||||
if (u == UCS_NO_CHAR) {
|
||||
/* Assume the incomplete sequence
|
||||
* costs one cell. */
|
||||
@ -570,7 +570,7 @@ unicode_fold_label_case(unicode_val_T c)
|
||||
}
|
||||
|
||||
inline unicode_val_T
|
||||
utf_8_to_unicode(unsigned char **string, unsigned char *end)
|
||||
utf8_to_unicode(unsigned char **string, unsigned char *end)
|
||||
{
|
||||
unsigned char *str = *string;
|
||||
unicode_val_T u;
|
||||
@ -623,7 +623,7 @@ utf_8_to_unicode(unsigned char **string, unsigned char *end)
|
||||
}
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
|
||||
/* Slow algorithm, the common part of cp2u and cp2utf_8. */
|
||||
/* Slow algorithm, the common part of cp2u and cp2utf8. */
|
||||
static unicode_val_T
|
||||
cp2u_shared(const struct codepage_desc *from, unsigned char c)
|
||||
{
|
||||
@ -653,14 +653,14 @@ cp2u(int from, unsigned char c)
|
||||
|
||||
/* This slow and ugly code is used by the terminal utf_8_io */
|
||||
unsigned char *
|
||||
cp2utf_8(int from, int c)
|
||||
cp2utf8(int from, int c)
|
||||
{
|
||||
from &= ~SYSTEM_CHARSET_FLAG;
|
||||
|
||||
if (codepages[from].table == table_utf_8 || c < 128)
|
||||
return strings[c];
|
||||
|
||||
return encode_utf_8(cp2u_shared(&codepages[from], c));
|
||||
return encode_utf8(cp2u_shared(&codepages[from], c));
|
||||
}
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
@ -670,7 +670,7 @@ cp_to_unicode(int codepage, unsigned char **string, unsigned char *end)
|
||||
unicode_val_T ret;
|
||||
|
||||
if (is_cp_utf8(codepage))
|
||||
return utf_8_to_unicode(string, end);
|
||||
return utf8_to_unicode(string, end);
|
||||
|
||||
if (*string >= end)
|
||||
return UCS_NO_CHAR;
|
||||
@ -683,9 +683,9 @@ cp_to_unicode(int codepage, unsigned char **string, unsigned char *end)
|
||||
|
||||
|
||||
static void
|
||||
add_utf_8(struct conv_table *ct, unicode_val_T u, unsigned char *str)
|
||||
add_utf8(struct conv_table *ct, unicode_val_T u, unsigned char *str)
|
||||
{
|
||||
unsigned char *p = encode_utf_8(u);
|
||||
unsigned char *p = encode_utf8(u);
|
||||
|
||||
while (p[1]) {
|
||||
if (ct[*p].t) ct = ct[*p].u.tbl;
|
||||
@ -725,7 +725,7 @@ free_utf_table(void)
|
||||
}
|
||||
|
||||
static struct conv_table *
|
||||
get_translation_table_to_utf_8(int from)
|
||||
get_translation_table_to_utf8(int from)
|
||||
{
|
||||
int i;
|
||||
static int lfr = -1;
|
||||
@ -757,7 +757,7 @@ get_translation_table_to_utf_8(int from)
|
||||
|
||||
if (!utf_table[codepages[from].table[i].c].u.str)
|
||||
utf_table[codepages[from].table[i].c].u.str =
|
||||
stracpy(encode_utf_8(u));
|
||||
stracpy(encode_utf8(u));
|
||||
}
|
||||
|
||||
for (i = 128; i < 256; i++)
|
||||
@ -797,7 +797,7 @@ get_translation_table(int from, int to)
|
||||
if (/*from == to ||*/ from == -1 || to == -1)
|
||||
return NULL;
|
||||
if (codepages[to].table == table_utf_8)
|
||||
return get_translation_table_to_utf_8(from);
|
||||
return get_translation_table_to_utf8(from);
|
||||
if (from == lfr && to == lto)
|
||||
return table;
|
||||
lfr = from;
|
||||
@ -808,13 +808,13 @@ get_translation_table(int from, int to)
|
||||
int i;
|
||||
|
||||
for (i = 0; codepages[to].table[i].c; i++)
|
||||
add_utf_8(table, codepages[to].table[i].u,
|
||||
strings[codepages[to].table[i].c]);
|
||||
add_utf8(table, codepages[to].table[i].u,
|
||||
strings[codepages[to].table[i].c]);
|
||||
|
||||
for (i = 0; unicode_7b[i].x != -1; i++)
|
||||
if (unicode_7b[i].x >= 0x80)
|
||||
add_utf_8(table, unicode_7b[i].x,
|
||||
unicode_7b[i].s);
|
||||
add_utf8(table, unicode_7b[i].x,
|
||||
unicode_7b[i].s);
|
||||
|
||||
} else {
|
||||
int i;
|
||||
|
@ -11,7 +11,7 @@ typedef uint32_t unicode_val_T;
|
||||
#define UCS_REPLACEMENT_CHARACTER ((unicode_val_T) 0xFFFD)
|
||||
|
||||
/* A special value that fits in unicode_val_T but is outside the range
|
||||
* of Unicode characters. utf_8_to_unicode and cp_to_unicode return
|
||||
* of Unicode characters. utf8_to_unicode and cp_to_unicode return
|
||||
* this if the input is too short. This is also used as a placeholder
|
||||
* for the second cell of a double-cell character. */
|
||||
#define UCS_NO_CHAR ((unicode_val_T) 0xFFFFFFFD)
|
||||
@ -64,7 +64,7 @@ unsigned char *get_cp_mime_name(int);
|
||||
int is_cp_utf8(int);
|
||||
void free_conv_table(void);
|
||||
#ifdef CONFIG_UTF_8
|
||||
inline unsigned char *encode_utf_8(unicode_val_T);
|
||||
inline unsigned char *encode_utf8(unicode_val_T);
|
||||
inline unsigned char *utf8_prevchar(unsigned char *, int, unsigned char *);
|
||||
inline int utf8charlen(const unsigned char *);
|
||||
int utf8_char2cells(unsigned char *, unsigned char *);
|
||||
@ -94,12 +94,12 @@ unsigned char *utf8_step_backward(unsigned char *, unsigned char *,
|
||||
inline int unicode_to_cell(unicode_val_T);
|
||||
unicode_val_T unicode_fold_label_case(unicode_val_T);
|
||||
inline int strlen_utf8(unsigned char **);
|
||||
inline unicode_val_T utf_8_to_unicode(unsigned char **, unsigned char *);
|
||||
inline unicode_val_T utf8_to_unicode(unsigned char **, unsigned char *);
|
||||
unicode_val_T cp_to_unicode(int, unsigned char **, unsigned char *);
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
|
||||
unicode_val_T cp2u(int, unsigned char);
|
||||
unsigned char *cp2utf_8(int, int);
|
||||
unsigned char *cp2utf8(int, int);
|
||||
|
||||
unsigned char *u2cp_(unicode_val_T, int, int no_nbsp_hack);
|
||||
#define u2cp(u, to) u2cp_(u, to, 0)
|
||||
|
@ -423,7 +423,7 @@ draw_text_utf8(struct terminal *term, int x, int y,
|
||||
if (length <= 0) return;
|
||||
if (x >= term->width) return;
|
||||
|
||||
data = utf_8_to_unicode(&text, end);
|
||||
data = utf8_to_unicode(&text, end);
|
||||
if (data == UCS_NO_CHAR) return;
|
||||
start = get_char(term, x, y);
|
||||
if (color) {
|
||||
@ -456,7 +456,7 @@ draw_text_utf8(struct terminal *term, int x, int y,
|
||||
x++;
|
||||
|
||||
for (; x < term->width; x++, pos++) {
|
||||
data = utf_8_to_unicode(&text, end);
|
||||
data = utf8_to_unicode(&text, end);
|
||||
if (data == UCS_NO_CHAR) break;
|
||||
if (color) copy_screen_chars(pos, start, 1);
|
||||
|
||||
|
@ -50,7 +50,7 @@ struct terminal_interlink {
|
||||
* converts it to Alt-0xC3 0xB6, attaching the
|
||||
* modifier to the first byte only. */
|
||||
term_event_modifier_T modifier;
|
||||
} utf_8;
|
||||
} utf8;
|
||||
|
||||
/* This is the queue of events as coming from the other ELinks instance
|
||||
* owning the hosting terminal. */
|
||||
@ -325,25 +325,25 @@ handle_interlink_event(struct terminal *term, struct interlink_event *ilev)
|
||||
* it is between 0x00 and 0x7F and it is straight ASCII.
|
||||
* (All 'betweens' are inclusive.) */
|
||||
|
||||
if (interlink->utf_8.len) {
|
||||
if (interlink->utf8.len) {
|
||||
/* A previous call to handle_interlink_event
|
||||
* got a UTF-8 start byte. */
|
||||
|
||||
if (key >= 0x80 && key <= 0xBF && utf8_io) {
|
||||
/* This is a UTF-8 continuation byte. */
|
||||
|
||||
interlink->utf_8.ucs <<= 6;
|
||||
interlink->utf_8.ucs |= key & 0x3F;
|
||||
if (! --interlink->utf_8.len) {
|
||||
unicode_val_T u = interlink->utf_8.ucs;
|
||||
interlink->utf8.ucs <<= 6;
|
||||
interlink->utf8.ucs |= key & 0x3F;
|
||||
if (! --interlink->utf8.len) {
|
||||
unicode_val_T u = interlink->utf8.ucs;
|
||||
|
||||
/* UTF-8 allows neither overlong
|
||||
* sequences nor surrogates. */
|
||||
if (u < interlink->utf_8.min
|
||||
if (u < interlink->utf8.min
|
||||
|| is_utf16_surrogate(u))
|
||||
u = UCS_REPLACEMENT_CHARACTER;
|
||||
term_send_ucs(term, u,
|
||||
term->interlink->utf_8.modifier);
|
||||
term->interlink->utf8.modifier);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -354,9 +354,9 @@ handle_interlink_event(struct terminal *term, struct interlink_event *ilev)
|
||||
* terminated character, but don't break;
|
||||
* let this byte be handled below. */
|
||||
|
||||
interlink->utf_8.len = 0;
|
||||
interlink->utf8.len = 0;
|
||||
term_send_ucs(term, UCS_REPLACEMENT_CHARACTER,
|
||||
term->interlink->utf_8.modifier);
|
||||
term->interlink->utf8.modifier);
|
||||
}
|
||||
}
|
||||
|
||||
@ -415,16 +415,16 @@ handle_interlink_event(struct terminal *term, struct interlink_event *ilev)
|
||||
|
||||
/* This will hold because @key was checked above. */
|
||||
assert(len >= 2 && len <= 6);
|
||||
if_assert_failed goto invalid_utf_8_start_byte;
|
||||
if_assert_failed goto invalid_utf8_start_byte;
|
||||
|
||||
interlink->utf_8.min = min[len - 2];
|
||||
interlink->utf_8.len = len - 1;
|
||||
interlink->utf_8.ucs = key & (mask - 1);
|
||||
interlink->utf_8.modifier = modifier;
|
||||
interlink->utf8.min = min[len - 2];
|
||||
interlink->utf8.len = len - 1;
|
||||
interlink->utf8.ucs = key & (mask - 1);
|
||||
interlink->utf8.modifier = modifier;
|
||||
break;
|
||||
}
|
||||
|
||||
invalid_utf_8_start_byte:
|
||||
invalid_utf8_start_byte:
|
||||
term_send_ucs(term, UCS_REPLACEMENT_CHARACTER, modifier);
|
||||
break;
|
||||
}
|
||||
|
@ -542,11 +542,11 @@ add_char_data(struct string *screen, struct screen_driver *driver,
|
||||
add_char_to_string(screen, (unsigned char)data);
|
||||
else
|
||||
if (data != UCS_NO_CHAR)
|
||||
add_to_string(screen, encode_utf_8(data));
|
||||
add_to_string(screen, encode_utf8(data));
|
||||
#else
|
||||
int charset = driver->charsets[!!border];
|
||||
|
||||
add_to_string(screen, cp2utf_8(charset, data));
|
||||
add_to_string(screen, cp2utf8(charset, data));
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
return;
|
||||
}
|
||||
|
@ -357,7 +357,7 @@ add_document_to_string(struct string *string, struct document *document)
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
if (is_cp_utf8(document->options.cp))
|
||||
goto utf_8;
|
||||
goto utf8;
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
|
||||
for (y = 0; y < document->height; y++) {
|
||||
@ -394,7 +394,7 @@ add_document_to_string(struct string *string, struct document *document)
|
||||
}
|
||||
#ifdef CONFIG_UTF_8
|
||||
goto end;
|
||||
utf_8:
|
||||
utf8:
|
||||
for (y = 0; y < document->height; y++) {
|
||||
struct screen_char *pos = document->data[y].chars;
|
||||
int white = 0;
|
||||
@ -422,7 +422,7 @@ utf_8:
|
||||
if (frame)
|
||||
add_char_to_string(string, data);
|
||||
else
|
||||
add_to_string(string, encode_utf_8(data));
|
||||
add_to_string(string, encode_utf8(data));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -851,7 +851,7 @@ dump_to_file(struct document *document, int fd)
|
||||
|
||||
#ifdef CONFIG_UTF_8
|
||||
if (is_cp_utf8(document->options.cp))
|
||||
goto utf_8;
|
||||
goto utf8;
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
|
||||
for (y = 0; y < document->height; y++) {
|
||||
@ -892,7 +892,7 @@ dump_to_file(struct document *document, int fd)
|
||||
}
|
||||
#ifdef CONFIG_UTF_8
|
||||
goto ref;
|
||||
utf_8:
|
||||
utf8:
|
||||
for (y = 0; y < document->height; y++) {
|
||||
int white = 0;
|
||||
int x;
|
||||
@ -907,7 +907,7 @@ utf_8:
|
||||
&& c >= 176 && c < 224)
|
||||
c = frame_dumb[c - 176];
|
||||
else {
|
||||
unsigned char *utf8_buf = encode_utf_8(c);
|
||||
unsigned char *utf8_buf = encode_utf8(c);
|
||||
|
||||
while (*utf8_buf) {
|
||||
if (write_char(*utf8_buf++,
|
||||
|
@ -352,7 +352,7 @@ draw_form_entry(struct terminal *term, struct document_view *doc_view,
|
||||
|
||||
x = link->points[0].x + dx;
|
||||
#ifdef CONFIG_UTF_8
|
||||
if (term->utf8) goto utf_8;
|
||||
if (term->utf8) goto utf8;
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
int_bounds(&fs->vpos, fs->state - fc->size + 1, fs->state);
|
||||
len = strlen(fs->value) - fs->vpos;
|
||||
@ -372,7 +372,7 @@ draw_form_entry(struct terminal *term, struct document_view *doc_view,
|
||||
}
|
||||
break;
|
||||
#ifdef CONFIG_UTF_8
|
||||
utf_8:
|
||||
utf8:
|
||||
retried = 0;
|
||||
|
||||
retry_after_scroll:
|
||||
@ -390,7 +390,7 @@ retry_after_scroll:
|
||||
int cells, cell;
|
||||
unsigned char *maybe_in_view = text;
|
||||
|
||||
data = utf_8_to_unicode(&text, end);
|
||||
data = utf8_to_unicode(&text, end);
|
||||
if (data == UCS_NO_CHAR) /* end of string */
|
||||
data = '_';
|
||||
else if (fc->type == FC_PASSWORD)
|
||||
@ -475,7 +475,7 @@ drew_char:
|
||||
* fully displayed. If there is no
|
||||
* such character, reserve one cell
|
||||
* for the cursor anyway. */
|
||||
if (utf_8_to_unicode(&ptr, end) == UCS_NO_CHAR)
|
||||
if (utf8_to_unicode(&ptr, end) == UCS_NO_CHAR)
|
||||
--cells;
|
||||
ptr = utf8_step_backward(ptr, fs->value,
|
||||
cells, how, NULL);
|
||||
@ -507,7 +507,7 @@ drew_char:
|
||||
/* XXX: when can this happen? --pasky */
|
||||
s = "";
|
||||
#ifdef CONFIG_UTF_8
|
||||
if (term->utf8) goto utf_8_select;
|
||||
if (term->utf8) goto utf8_select;
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
len = s ? strlen(s) : 0;
|
||||
for (i = 0; i < link->npoints; i++) {
|
||||
@ -518,7 +518,7 @@ drew_char:
|
||||
}
|
||||
break;
|
||||
#ifdef CONFIG_UTF_8
|
||||
utf_8_select:
|
||||
utf8_select:
|
||||
text = s;
|
||||
end = strchr(s, '\0');
|
||||
len = utf8_ptr2cells(text, end);
|
||||
@ -530,7 +530,7 @@ utf_8_select:
|
||||
if (i < len) {
|
||||
int cell;
|
||||
|
||||
data = utf_8_to_unicode(&s, end);
|
||||
data = utf8_to_unicode(&s, end);
|
||||
cell = unicode_to_cell(data);
|
||||
if (i + 1 < len && cell == 2) {
|
||||
draw_char_data(term, x++, y, data);
|
||||
@ -1402,7 +1402,7 @@ field_op(struct session *ses, struct document_view *doc_view,
|
||||
unsigned char *text = fs->value + fs->state;
|
||||
unsigned char *end = strchr(text, '\0');
|
||||
|
||||
utf_8_to_unicode(&text, end);
|
||||
utf8_to_unicode(&text, end);
|
||||
fs->state = (int)(text - fs->value);
|
||||
} else
|
||||
#endif /* CONFIG_UTF_8 */
|
||||
@ -1592,7 +1592,7 @@ field_op(struct session *ses, struct document_view *doc_view,
|
||||
unsigned char *text = fs->value + fs->state;
|
||||
unsigned char *old = text;
|
||||
|
||||
utf_8_to_unicode(&text, end);
|
||||
utf8_to_unicode(&text, end);
|
||||
if (old != text) {
|
||||
memmove(old, text,
|
||||
(int)(end - text) + 1);
|
||||
|
@ -464,7 +464,7 @@ memacpy_u(unsigned char *text, int textlen, int utf8)
|
||||
int i;
|
||||
|
||||
for (i = 0; i < textlen; i++)
|
||||
mem[i] = utf_8_to_unicode(&text, text + 7);
|
||||
mem[i] = utf8_to_unicode(&text, text + 7);
|
||||
} else {
|
||||
int i;
|
||||
|
||||
|
@ -367,7 +367,7 @@ draw_textarea_utf8(struct terminal *term, struct form_state *fs,
|
||||
if (i >= -fs->vpos && text < end) {
|
||||
int cell;
|
||||
|
||||
data = utf_8_to_unicode(&text, end);
|
||||
data = utf8_to_unicode(&text, end);
|
||||
cell = unicode_to_cell(data);
|
||||
if (cell == 2) {
|
||||
draw_char_data(term, x++, y, data);
|
||||
@ -754,7 +754,7 @@ new_pos(struct form_state *fs, struct line_info *line, int current, int max_cell
|
||||
int cells = 0;
|
||||
|
||||
while(cells < max_cells) {
|
||||
unicode_val_T data = utf_8_to_unicode(&text, end);
|
||||
unicode_val_T data = utf8_to_unicode(&text, end);
|
||||
|
||||
if (data == UCS_NO_CHAR) break;
|
||||
cells += unicode_to_cell(data);
|
||||
@ -1135,7 +1135,7 @@ do_op_right(struct form_state *fs, struct line_info *line, int current, int utf8
|
||||
text = fs->value + fs->state;
|
||||
end = strchr(text, '\0');
|
||||
old_state = fs->state;
|
||||
utf_8_to_unicode(&text, end);
|
||||
utf8_to_unicode(&text, end);
|
||||
|
||||
fs->state = text - fs->value;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user