mirror of
https://github.com/rkd77/elinks.git
synced 2024-09-28 03:06:20 -04:00
Compilation fixes (CONFIG_UTF_8): move variables declarations at start
of blocks. Old compilers do not support in-block declarations.
This commit is contained in:
parent
3ff8422e76
commit
a897a95721
@ -410,6 +410,9 @@ draw_menu_left_text_hk(struct terminal *term, unsigned char *text,
|
|||||||
int xbase = x + L_TEXT_SPACE;
|
int xbase = x + L_TEXT_SPACE;
|
||||||
int w = width - (L_TEXT_SPACE + R_TEXT_SPACE);
|
int w = width - (L_TEXT_SPACE + R_TEXT_SPACE);
|
||||||
int hk_state = 0;
|
int hk_state = 0;
|
||||||
|
#ifdef CONFIG_UTF_8
|
||||||
|
unsigned char *text2, *end;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_DEBUG
|
#ifdef CONFIG_DEBUG
|
||||||
/* For redundant hotkeys highlighting. */
|
/* For redundant hotkeys highlighting. */
|
||||||
@ -450,8 +453,8 @@ draw_menu_left_text_hk(struct terminal *term, unsigned char *text,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#ifdef CONFIG_UTF_8
|
#ifdef CONFIG_UTF_8
|
||||||
unsigned char *text2, *end;
|
|
||||||
utf8:
|
utf8:
|
||||||
end = strchr(text, '\0');
|
end = strchr(text, '\0');
|
||||||
text2 = text;
|
text2 = text;
|
||||||
|
@ -150,9 +150,10 @@ draw_line(struct terminal *term, int x, int y, int l, struct screen_char *line)
|
|||||||
struct screen_char *sc;
|
struct screen_char *sc;
|
||||||
|
|
||||||
if (line->data == UCS_NO_CHAR && x == 0) {
|
if (line->data == UCS_NO_CHAR && x == 0) {
|
||||||
sc = line;
|
unicode_val_T data_save;
|
||||||
unicode_val_T data_save = sc->data;
|
|
||||||
|
|
||||||
|
sc = line;
|
||||||
|
data_save = sc->data;
|
||||||
sc->data = ' ';
|
sc->data = ' ';
|
||||||
copy_screen_chars(screen_char, line, 1);
|
copy_screen_chars(screen_char, line, 1);
|
||||||
sc->data = data_save;
|
sc->data = data_save;
|
||||||
@ -164,9 +165,10 @@ draw_line(struct terminal *term, int x, int y, int l, struct screen_char *line)
|
|||||||
/* Instead of displaying double-width character at last column
|
/* Instead of displaying double-width character at last column
|
||||||
* display only space. */
|
* display only space. */
|
||||||
if (size - 1 > 0 && unicode_to_cell(line[size - 1].data) == 2) {
|
if (size - 1 > 0 && unicode_to_cell(line[size - 1].data) == 2) {
|
||||||
|
unicode_val_T data_save;
|
||||||
|
|
||||||
sc = &line[size - 1];
|
sc = &line[size - 1];
|
||||||
unicode_val_T data_save = sc->data;
|
data_save = sc->data;
|
||||||
|
|
||||||
sc->data = ' ';
|
sc->data = ' ';
|
||||||
copy_screen_chars(screen_char, line, size);
|
copy_screen_chars(screen_char, line, size);
|
||||||
sc->data = data_save;
|
sc->data = data_save;
|
||||||
|
@ -785,6 +785,8 @@ do_op_home(struct form_state *fs, struct line_info *line, int current)
|
|||||||
static int
|
static int
|
||||||
do_op_up(struct form_state *fs, struct line_info *line, int current, int utf8)
|
do_op_up(struct form_state *fs, struct line_info *line, int current, int utf8)
|
||||||
{
|
{
|
||||||
|
int old_state;
|
||||||
|
|
||||||
if (current == -1) return 0;
|
if (current == -1) return 0;
|
||||||
|
|
||||||
if (!(current - !!fs->state_cell)) return 1;
|
if (!(current - !!fs->state_cell)) return 1;
|
||||||
@ -795,7 +797,7 @@ do_op_up(struct form_state *fs, struct line_info *line, int current, int utf8)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int old_state = fs->state;
|
old_state = fs->state;
|
||||||
if (fs->state_cell) {
|
if (fs->state_cell) {
|
||||||
int len = utf8_ptr2cells(fs->value + line[current - 1].start,
|
int len = utf8_ptr2cells(fs->value + line[current - 1].start,
|
||||||
fs->value + fs->state_cell);
|
fs->value + fs->state_cell);
|
||||||
@ -839,6 +841,8 @@ do_op_up(struct form_state *fs, struct line_info *line, int current)
|
|||||||
static int
|
static int
|
||||||
do_op_down(struct form_state *fs, struct line_info *line, int current, int utf8)
|
do_op_down(struct form_state *fs, struct line_info *line, int current, int utf8)
|
||||||
{
|
{
|
||||||
|
int old_state;
|
||||||
|
|
||||||
if (current == -1) return 0;
|
if (current == -1) return 0;
|
||||||
|
|
||||||
if (line[current + 1 - !!fs->state_cell].start == -1) return 1;
|
if (line[current + 1 - !!fs->state_cell].start == -1) return 1;
|
||||||
@ -849,7 +853,7 @@ do_op_down(struct form_state *fs, struct line_info *line, int current, int utf8)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int old_state = fs->state;
|
old_state = fs->state;
|
||||||
if (fs->state_cell) {
|
if (fs->state_cell) {
|
||||||
int len = utf8_ptr2cells(fs->value + line[current - 1].start,
|
int len = utf8_ptr2cells(fs->value + line[current - 1].start,
|
||||||
fs->value + fs->state_cell);
|
fs->value + fs->state_cell);
|
||||||
@ -1083,6 +1087,10 @@ textarea_op_enter(struct form_state *fs, struct form_control *fc)
|
|||||||
static int
|
static int
|
||||||
do_op_left(struct form_state *fs, struct line_info *line, int current, int utf8)
|
do_op_left(struct form_state *fs, struct line_info *line, int current, int utf8)
|
||||||
{
|
{
|
||||||
|
int old_state;
|
||||||
|
int new_state;
|
||||||
|
unsigned char *new_value;
|
||||||
|
|
||||||
if (!utf8) {
|
if (!utf8) {
|
||||||
fs->state = int_max(fs->state - 1, 0);
|
fs->state = int_max(fs->state - 1, 0);
|
||||||
return 0;
|
return 0;
|
||||||
@ -1094,10 +1102,7 @@ do_op_left(struct form_state *fs, struct line_info *line, int current, int utf8)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int old_state = fs->state;
|
old_state = fs->state;
|
||||||
int new_state;
|
|
||||||
unsigned char *new_value;
|
|
||||||
|
|
||||||
new_value = utf8_prevchar(fs->value + fs->state, 1, fs->value);
|
new_value = utf8_prevchar(fs->value + fs->state, 1, fs->value);
|
||||||
new_state = new_value - fs->value;
|
new_state = new_value - fs->value;
|
||||||
|
|
||||||
@ -1113,6 +1118,9 @@ do_op_left(struct form_state *fs, struct line_info *line, int current, int utf8)
|
|||||||
static int
|
static int
|
||||||
do_op_right(struct form_state *fs, struct line_info *line, int current, int utf8)
|
do_op_right(struct form_state *fs, struct line_info *line, int current, int utf8)
|
||||||
{
|
{
|
||||||
|
unsigned char *text, *end;
|
||||||
|
int old_state;
|
||||||
|
|
||||||
if (!utf8) {
|
if (!utf8) {
|
||||||
/* TODO: zle */
|
/* TODO: zle */
|
||||||
fs->state = int_min(fs->state + 1, strlen(fs->value));
|
fs->state = int_min(fs->state + 1, strlen(fs->value));
|
||||||
@ -1124,9 +1132,9 @@ do_op_right(struct form_state *fs, struct line_info *line, int current, int utf8
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned char *text = fs->value + fs->state;
|
text = fs->value + fs->state;
|
||||||
unsigned char *end = strchr(text, '\0');
|
end = strchr(text, '\0');
|
||||||
int old_state = fs->state;
|
old_state = fs->state;
|
||||||
utf_8_to_unicode(&text, end);
|
utf_8_to_unicode(&text, end);
|
||||||
|
|
||||||
fs->state = text - fs->value;
|
fs->state = text - fs->value;
|
||||||
|
Loading…
Reference in New Issue
Block a user