1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-06-14 23:32:27 +00:00

[menu] Removed unused function

This commit is contained in:
Witold Filipczyk 2022-03-19 10:23:45 +01:00
parent cd6f8a9ea4
commit 75aa0359a0

View File

@ -426,129 +426,6 @@ draw_menu_left_text_node(struct terminal *term, char *text, int len,
}
static inline void
draw_menu_left_text_hk(struct terminal *term, char *text,
int hotkey_pos, int x, int y, int width,
struct color_pair *color, int selected)
{
struct color_pair *hk_color = get_bfu_color(term, "menu.hotkey.normal");
struct color_pair *hk_color_sel = get_bfu_color(term, "menu.hotkey.selected");
screen_char_attr_T hk_attr = get_opt_bool("ui.dialogs.underline_hotkeys", NULL)
? SCREEN_ATTR_UNDERLINE : 0;
unsigned char c;
int xbase = x + L_TEXT_SPACE;
int w = width - (L_TEXT_SPACE + R_TEXT_SPACE);
int hk_state = 0;
#ifdef CONFIG_UTF8
char *text2, *end;
#endif
#ifdef CONFIG_DEBUG
/* For redundant hotkeys highlighting. */
int double_hk = 0;
if (hotkey_pos < 0) hotkey_pos = -hotkey_pos, double_hk = 1;
#endif
if (!hotkey_pos || w <= 0) return;
if (selected) {
struct color_pair *tmp = hk_color;
hk_color = hk_color_sel;
hk_color_sel = tmp;
}
#ifdef CONFIG_UTF8
if (term->utf8_cp) goto utf8;
#endif /* CONFIG_UTF8 */
for (x = 0; x - !!hk_state < w && (c = text[x]); x++) {
if (!hk_state && x == hotkey_pos - 1) {
hk_state = 1;
continue;
}
if (hk_state == 1) {
#ifdef CONFIG_DEBUG
draw_char(term, xbase + x - 1, y, c, hk_attr,
(double_hk ? hk_color_sel : hk_color));
#else
draw_char(term, xbase + x - 1, y, c, hk_attr, hk_color);
#endif /* CONFIG_DEBUG */
hk_state = 2;
} else {
draw_char(term, xbase + x - !!hk_state, y, c, 0, color);
}
}
return;
#ifdef CONFIG_UTF8
utf8:
end = strchr(text, '\0');
text2 = text;
for (x = 0; x - !!hk_state < w && *text2; x++) {
unicode_val_T data;
data = utf8_to_unicode(&text2, end);
if (!hk_state && (int)(text2 - text) == hotkey_pos) {
hk_state = 1;
continue;
}
if (hk_state == 1) {
if (unicode_to_cell(data) == 2) {
if (x < w && xbase + x < term->width) {
#ifdef CONFIG_DEBUG
draw_char(term, xbase + x - 1, y,
data, hk_attr,
(double_hk ? hk_color_sel
: hk_color));
#else
draw_char(term, xbase + x - 1, y,
data, hk_attr, hk_color);
#endif /* CONFIG_DEBUG */
x++;
draw_char(term, xbase + x - 1, y,
UCS_NO_CHAR, 0, hk_color);
} else {
draw_char(term, xbase + x - 1, y,
UCS_ORPHAN_CELL, 0, hk_color);
}
} else {
#ifdef CONFIG_DEBUG
draw_char(term, xbase + x - 1, y,
data, hk_attr,
(double_hk ? hk_color_sel
: hk_color));
#else
draw_char(term, xbase + x - 1, y,
data, hk_attr, hk_color);
#endif /* CONFIG_DEBUG */
}
hk_state = 2;
} else {
if (unicode_to_cell(data) == 2) {
if (x - !!hk_state + 1 < w &&
xbase + x - !!hk_state + 1 < term->width) {
draw_char(term, xbase + x - !!hk_state,
y, data, 0, color);
x++;
draw_char(term, xbase + x - !!hk_state,
y, UCS_NO_CHAR, 0, color);
} else {
draw_char(term, xbase + x - !!hk_state,
y, UCS_ORPHAN_CELL, 0, color);
}
} else {
draw_char(term, xbase + x - !!hk_state,
y, data, 0, color);
}
}
}
#endif /* CONFIG_UTF8 */
}
static inline void
draw_menu_left_text_hk_node(struct terminal *term, char *text,
int hotkey_pos, int x, int y, int width,