1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-07-26 16:45:12 -04:00

Trim trailing whitespaces.

This commit is contained in:
Laurent MONIN 2006-07-27 09:51:10 +02:00 committed by Laurent MONIN
parent a897a95721
commit 1136aefb71
19 changed files with 67 additions and 67 deletions

View File

@ -89,7 +89,7 @@ buttons_width(struct widget_data *widget_data, int n,
{
int maxw = -BUTTON_HSPACING;
#ifdef CONFIG_UTF_8
int button_lr_len = utf8_ptr2cells(BUTTON_LEFT, NULL)
int button_lr_len = utf8_ptr2cells(BUTTON_LEFT, NULL)
+ utf8_ptr2cells(BUTTON_RIGHT, NULL);
#endif /* CONFIG_UTF_8 */
@ -150,7 +150,7 @@ dlg_format_buttons(struct terminal *term,
int i;
int p = x + (align == ALIGN_CENTER ? (w - mw) / 2 : 0);
#ifdef CONFIG_UTF_8
int button_lr_len = utf8_ptr2cells(BUTTON_LEFT, NULL)
int button_lr_len = utf8_ptr2cells(BUTTON_LEFT, NULL)
+ utf8_ptr2cells(BUTTON_RIGHT, NULL);
#endif /* CONFIG_UTF_8 */
@ -201,9 +201,9 @@ display_button(struct dialog_data *dlg_data, struct widget_data *widget_data)
int button_right_len = utf8_ptr2cells(BUTTON_RIGHT, NULL);
x = pos->x + button_left_len;
len = widget_data->box.width -
len = widget_data->box.width -
(button_left_len + button_right_len);
} else
#endif /* CONFIG_UTF_8 */
{
@ -227,38 +227,38 @@ display_button(struct dialog_data *dlg_data, struct widget_data *widget_data)
int hk_bytes = utf8charlen(&text[hk_pos+1]);
int cells_to_hk = utf8_ptr2cells(text,
&text[hk_pos]);
int right = widget_data->widget->info.button.truetextlen
- hk_pos
int right = widget_data->widget->info.button.truetextlen
- hk_pos
- hk_bytes;
int hk_cells = utf8_char2cells(&text[hk_pos
int hk_cells = utf8_char2cells(&text[hk_pos
+ 1],
NULL);
if (hk_pos)
draw_text(term, x, pos->y,
draw_text(term, x, pos->y,
text, hk_pos, 0, color);
draw_text(term, x + cells_to_hk, pos->y,
&text[hk_pos + 1], hk_bytes,
&text[hk_pos + 1], hk_bytes,
attr, shortcut_color);
if (right > 1)
draw_text(term, x+cells_to_hk+hk_cells,
pos->y,
draw_text(term, x+cells_to_hk+hk_cells,
pos->y,
&text[hk_pos + hk_bytes + 1],
right - 1, 0, color);
} else {
int hk_width = utf8_char2cells(text, NULL);
int hk_len = utf8charlen(text);
int len_to_display =
utf8_cells2bytes(&text[hk_len],
int len_to_display =
utf8_cells2bytes(&text[hk_len],
len - hk_width,
NULL);
draw_text(term, x, pos->y,
text, hk_len,
draw_text(term, x, pos->y,
text, hk_len,
attr, shortcut_color);
draw_text(term, x + hk_width, pos->y,
@ -290,7 +290,7 @@ display_button(struct dialog_data *dlg_data, struct widget_data *widget_data)
int text_cells = utf8_ptr2cells(widget_data->widget->text, NULL);
int hk = (widget_data->widget->info.button.hotkey_pos >= 0);
draw_text(term, x + text_cells - hk, pos->y,
draw_text(term, x + text_cells - hk, pos->y,
BUTTON_RIGHT, BUTTON_RIGHT_LEN, 0, color);
} else
#endif /* CONFIG_UTF_8 */

View File

@ -103,7 +103,7 @@ redraw_dialog(struct dialog_data *dlg_data, int layout)
#ifdef CONFIG_UTF_8
if (term->utf8)
titlecells = utf8_ptr2cells(title,
titlecells = utf8_ptr2cells(title,
&title[titlelen]);
#endif /* CONFIG_UTF_8 */

View File

@ -113,13 +113,13 @@ dlg_format_group(struct terminal *term,
text,
label_length,
NULL);
draw_text(term, xpos, *y,
draw_text(term, xpos, *y,
text, lb, 0, color);
} else
#endif /* CONFIG_UTF_8 */
{
draw_text(term, xpos, *y,
text, label_length,
draw_text(term, xpos, *y,
text, label_length,
0, color);
}
}

View File

@ -279,8 +279,8 @@ display_field_do(struct dialog_data *dlg_data, struct widget_data *widget_data,
int_bounds(&left, len - widget_data->box.width + 1, len);
int_lower_bound(&left, 0);
widget_data->info.field.vpos = utf8_cells2bytes(t, left, NULL);
} else
#endif /* CONFIG_UTF_8 */
} else
#endif /* CONFIG_UTF_8 */
{
int_bounds(&widget_data->info.field.vpos,
widget_data->info.field.cpos - widget_data->box.width + 1,
@ -330,7 +330,7 @@ display_field_do(struct dialog_data *dlg_data, struct widget_data *widget_data,
#ifdef CONFIG_UTF_8
if (term->utf8)
x = widget_data->box.x + len - left;
else
else
#endif /* CONFIG_UTF_8 */
x = widget_data->box.x + widget_data->info.field.cpos - widget_data->info.field.vpos;
@ -477,7 +477,7 @@ kbd_field(struct dialog_data *dlg_data, struct widget_data *widget_data)
if (term->utf8) {
unsigned char *next = widget_data->cdata + widget_data->info.field.cpos;
unsigned char *end = strchr(next, '\0');
utf_8_to_unicode(&next, end);
widget_data->info.field.cpos = (int)(next - widget_data->cdata);
} else
@ -502,7 +502,7 @@ kbd_field(struct dialog_data *dlg_data, struct widget_data *widget_data)
strlen_utf8(&t2);
t[p] = tmp;
widget_data->info.field.cpos = (int)(t2 - t);
}
#endif /* CONFIG_UTF_8 */
goto display_field;
@ -696,7 +696,7 @@ kbd_field(struct dialog_data *dlg_data, struct widget_data *widget_data)
unsigned char *t = buf;
static int i = 0;
unicode_val_T data;
buf[i++] = *text;
buf[i] = '\0';
data = utf_8_to_unicode(&t, buf + i);

View File

@ -202,11 +202,11 @@ get_menuitem_text_width(struct terminal *term, struct menu_item *mi)
#ifdef CONFIG_UTF_8
if (term->utf8)
return L_TEXT_SPACE + utf8_ptr2cells(text, NULL)
return L_TEXT_SPACE + utf8_ptr2cells(text, NULL)
- !!mi->hotkey_pos + R_TEXT_SPACE;
else
#endif /* CONFIG_UTF_8 */
return L_TEXT_SPACE + strlen(text)
return L_TEXT_SPACE + strlen(text)
- !!mi->hotkey_pos + R_TEXT_SPACE;
}
@ -385,7 +385,7 @@ draw_menu_left_text(struct terminal *term, unsigned char *text, int len,
#ifdef CONFIG_UTF_8
if (term->utf8) {
max_len = utf8_cells2bytes(text, w, NULL);
if (max_len <= 0)
if (max_len <= 0)
return;
} else
#endif /* CONFIG_UTF_8 */
@ -479,10 +479,10 @@ utf8:
data, hk_attr, hk_color);
#endif /* CONFIG_DEBUG */
x++;
draw_char(term, xbase + x - 1, y,
draw_char(term, xbase + x - 1, y,
UCS_NO_CHAR, 0, hk_color);
} else {
draw_char(term, xbase + x - 1, y,
draw_char(term, xbase + x - 1, y,
' ', 0, hk_color);
}
} else {
@ -1165,7 +1165,7 @@ display_mainmenu(struct terminal *term, struct menu *menu)
if (menu->last < menu->size - 1) {
#ifdef CONFIG_UTF_8
if (term->utf8) {
struct screen_char *schar;
struct screen_char *schar;
schar = get_char(term, term->width - R_MAINMENU_SPACE, 0);
/* Is second cell of double-width char on the place where

View File

@ -54,7 +54,7 @@ split_line(unsigned char *text, int max_width, int *cells)
#ifdef CONFIG_UTF_8
if (utf8) {
unsigned char *next_char_begin = split
unsigned char *next_char_begin = split
+ utf8charlen(split);
next_split = split;
@ -64,7 +64,7 @@ split_line(unsigned char *text, int max_width, int *cells)
next_split++;
next_char_begin = next_split;
while (is_unsplitable(next_split))
while (is_unsplitable(next_split))
{
if (next_split < next_char_begin) {
next_split++;
@ -207,7 +207,7 @@ split_lines(struct widget_data *widget_data, int max_width)
void
dlg_format_text_do(struct terminal *term, unsigned char *text,
int x, int *y, int width, int *real_width,
struct color_pair *color, enum format_align align,
struct color_pair *color, enum format_align align,
int format_only)
{
int line_width;

View File

@ -377,7 +377,7 @@ do_move_bookmark(struct bookmark *dest, int insert_as_child,
if (box2->top == bm->box_item)
listbox_sel_move(widget_data, 1);
}
del_from_list(bm->box_item);
del_from_list(bm);
if (insert_as_child) {

View File

@ -516,7 +516,7 @@ add_opt(struct option *tree, unsigned char *path, unsigned char *capt,
return NULL;
}
}
add_opt_rec(tree, path, option);
return option;
}

View File

@ -446,8 +446,8 @@ display_title_bar(struct session *ses, struct terminal *term)
int x;
#ifdef CONFIG_UTF_8
if (term->utf8) {
x = int_max(term->width - 1
- utf8_ptr2cells(title.source,
x = int_max(term->width - 1
- utf8_ptr2cells(title.source,
title.source
+ title.length), 0);
} else

View File

@ -1552,7 +1552,7 @@ put_chars(struct html_context *html_context, unsigned char *chars, int charslen)
put_link_number(html_context);
}
#ifdef CONFIG_UTF_8
cells =
cells =
#endif /* CONFIG_UTF_8 */
set_hline(html_context, chars, charslen, link_state);

View File

@ -325,13 +325,13 @@ add_document_line(struct plain_renderer *renderer,
line_pos += charlen;
continue;
}
cell = unicode_to_cell(data);
}
#endif /* CONFIG_UTF_8 */
prev_char = line_pos > 0 ? line[line_pos - 1] : '\0';
next_char = (line_pos + charlen < width) ?
next_char = (line_pos + charlen < width) ?
line[line_pos + charlen] : '\0';
/* Do not expand tabs that precede back-spaces; this saves the
@ -531,7 +531,7 @@ add_document_lines(struct plain_renderer *renderer)
int cells = 0;
/* End of line detection: We handle \r, \r\n and \n types. */
for (width = 0; (width < length) &&
for (width = 0; (width < length) &&
(cells < renderer->max_width);) {
if (source[width] == ASCII_CR)
step++;

View File

@ -298,7 +298,7 @@ utf8_ptr2cells(unsigned char *string, unsigned char *end)
do {
charlen = utf8charlen(string);
if (string + charlen > end)
if (string + charlen > end)
break;
cell = utf8_char2cells(string, end);
@ -326,7 +326,7 @@ utf8_ptr2chars(unsigned char *string, unsigned char *end)
do {
charlen = utf8charlen(string);
if (string + charlen > end)
if (string + charlen > end)
break;
chars++;
@ -373,7 +373,7 @@ utf8_cells2bytes(unsigned char *string, int max_cells, unsigned char *end)
return bytes;
}
/*
/*
* Find out number of standard terminal collumns needed for displaying symbol
* (glyph) which represents Unicode character c.
* TODO: Use wcwidth when it is available.
@ -401,7 +401,7 @@ unicode_to_cell(unicode_val_T c)
|| (c >= 0x30000 && c <= 0x3fffd)))
return 2;
return 1;
return 1;
}
inline unicode_val_T
@ -415,7 +415,7 @@ utf_8_to_unicode(unsigned char **string, unsigned char *end)
if (str + length > end) {
return UCS_NO_CHAR;
}
}
switch (length) {
case 1:
@ -443,7 +443,7 @@ utf_8_to_unicode(unsigned char **string, unsigned char *end)
u += ((str[3] & 0x3f) << 6);
u += (str[4] & 0x3f);
break;
case 6:
case 6:
default:
u = (str[0] & 0x01) << 30;
u += ((str[1] & 0x3f) << 24);

View File

@ -418,8 +418,8 @@ static const unsigned char yyrline[] =
First, the terminals, then, starting at YYNTOKENS, nonterminals. */
static const char *const yytname[] =
{
"$end", "error", "$undefined", "'?'", "'|'", "'&'", "EQUOP2", "CMPOP2",
"ADDOP2", "MULOP2", "'!'", "NUMBER", "':'", "'n'", "'('", "')'",
"$end", "error", "$undefined", "'?'", "'|'", "'&'", "EQUOP2", "CMPOP2",
"ADDOP2", "MULOP2", "'!'", "NUMBER", "':'", "'n'", "'('", "')'",
"$accept", "start", "exp", 0
};
#endif
@ -1336,7 +1336,7 @@ yyerrlab1:
/* Suppress GCC warning that yyerrlab1 is unused when no action
invokes YYERROR. */
#if defined (__GNUC_MINOR__) && 2093 <= (__GNUC__ * 1000 + __GNUC_MINOR__)
/* but it's harmful in C++ code
/* but it's harmful in C++ code
* (gcc 3.2.1 complained about erroneous yylerrsp declaration) */
# ifndef __cplusplus
__attribute__ ((__unused__))

View File

@ -650,7 +650,7 @@ init_gopher_index_cache_entry(struct connection *conn)
where = get_uri_string(conn->uri, URI_PUBLIC);
/* TODO: Use different function when using UTF-8
/* TODO: Use different function when using UTF-8
* in terminal (decode_uri_for_display replaces
* bytes of UTF-8 characters width '*'). */
if (where) decode_uri_for_display(where);

View File

@ -107,14 +107,14 @@ void
draw_char_data(struct terminal *term, int x, int y, unicode_val_T data)
#else
draw_char_data(struct terminal *term, int x, int y, unsigned char data)
#endif /* CONFIG_UTF_8 */
#endif /* CONFIG_UTF_8 */
{
struct screen_char *screen_char = get_char(term, x, y);
if (!screen_char) return;
screen_char->data = data;
#ifdef CONFIG_UTF_8
#ifdef CONFIG_DEBUG
/* Detect attempt to draw double-width char on the last
@ -125,7 +125,7 @@ draw_char_data(struct terminal *term, int x, int y, unsigned char data)
if (data == UCS_NO_CHAR)
screen_char->attr = 0;
#endif /* CONFIG_UTF_8 */
#endif /* CONFIG_UTF_8 */
set_screen_dirty(term->screen, y, y);
}
@ -166,7 +166,7 @@ draw_line(struct terminal *term, int x, int y, int l, struct screen_char *line)
* display only space. */
if (size - 1 > 0 && unicode_to_cell(line[size - 1].data) == 2) {
unicode_val_T data_save;
sc = &line[size - 1];
data_save = sc->data;
sc->data = ' ';
@ -263,7 +263,7 @@ void
fix_dwchar_around_box(struct terminal *term, struct box *box, int border,
int shadow_width, int shadow_height)
{
struct screen_char *schar;
struct screen_char *schar;
int height, x, y;
if (!term->utf8)
@ -475,7 +475,7 @@ draw_text_utf8(struct terminal *term, int x, int y,
}
}
set_screen_dirty(term->screen, y, y);
}
#endif /* CONFIG_UTF_8 */

View File

@ -25,7 +25,7 @@ struct screen_char {
unicode_val_T data;
#else
unsigned char data;
#endif /* CONFIG_UTF_8 */
#endif /* CONFIG_UTF_8 */
/* Attributes are screen_char_attr bits. */
unsigned char attr;

View File

@ -464,7 +464,7 @@ add_char_data(struct string *screen, struct screen_driver *driver,
#ifdef CONFIG_UTF_8
if (border)
add_char_to_string(screen, (unsigned char)data);
else
else
if (data != UCS_NO_CHAR)
add_to_string(screen, encode_utf_8(data));
#else

View File

@ -387,7 +387,7 @@ utf_8:
len = utf8_ptr2cells(fs->value + fs->vpos, NULL);
text = fs->value;
end = strchr(text, '\0');
for (i = 0; i < fc->size; i++, x++) {
unicode_val_T data;
@ -1312,7 +1312,7 @@ field_op(struct session *ses, struct document_view *doc_view,
if (utf8) {
int old_state = fs->state;
unsigned char *new_value;
new_value = utf8_prevchar(fs->value + fs->state, 1, fs->value);
fs->state = new_value - fs->value;
@ -1522,7 +1522,7 @@ field_op(struct session *ses, struct document_view *doc_view,
if (utf8) {
int old_state = fs->state;
unsigned char *new_value;
new_value = utf8_prevchar(fs->value + fs->state, 1, fs->value);
fs->state = new_value - fs->value;
@ -1666,7 +1666,7 @@ field_op(struct session *ses, struct document_view *doc_view,
while (fs->state > 0
&& isspace(fs->value[fs->state - 1]))
--fs->state;
while (fs->state > 0
while (fs->state > 0
&& !isspace(fs->value[fs->state - 1]))
--fs->state;
break;

View File

@ -117,7 +117,7 @@ format_textutf8(unsigned char *text, int width, enum form_wrap wrap, int format)
begin = pos += skip;
chars_cells = 0;
wrappos = NULL;
wrappos = NULL;
}
line[line_number].split_next = 0;
@ -786,7 +786,7 @@ static int
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 - !!fs->state_cell)) return 1;