mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
[plain] one level of indentation less
This commit is contained in:
parent
d43028a0cf
commit
b1317c3e46
@ -857,98 +857,96 @@ fixup_tables(struct plain_renderer *renderer)
|
|||||||
struct line *next_line = y < renderer->lineno - 1 ? &renderer->document->data[y + 1] : NULL;
|
struct line *next_line = y < renderer->lineno - 1 ? &renderer->document->data[y + 1] : NULL;
|
||||||
|
|
||||||
for (x = 0; x < line->length; x++) {
|
for (x = 0; x < line->length; x++) {
|
||||||
|
int dir;
|
||||||
#ifdef CONFIG_UTF8
|
#ifdef CONFIG_UTF8
|
||||||
unicode_val_T ch = line->chars[x].data;
|
unicode_val_T ch = line->chars[x].data;
|
||||||
|
unicode_val_T prev_char, next_char, up_char, down_char;
|
||||||
#else
|
#else
|
||||||
unsigned char ch = line->chars[x].data;
|
unsigned char ch = line->chars[x].data;
|
||||||
|
unsigned char prev_char, next_char, up_char, down_char;
|
||||||
#endif
|
#endif
|
||||||
if (ch == '+' || ch == '-' || ch == '|') {
|
if (ch != '+' && ch != '-' && ch != '|') {
|
||||||
int dir;
|
continue;
|
||||||
#ifdef CONFIG_UTF8
|
}
|
||||||
unicode_val_T prev_char = x > 0 ? line->chars[x - 1].data : ' ';
|
|
||||||
unicode_val_T next_char = x < line->length - 1 ? line->chars[x + 1].data : ' ';
|
|
||||||
unicode_val_T up_char = (prev_line && x < prev_line->length) ? prev_line->chars[x].data : ' ';
|
|
||||||
unicode_val_T down_char = (next_line && x < next_line->length) ? next_line->chars[x].data : ' ';
|
|
||||||
#else
|
|
||||||
unsigned char prev_char = x > 0 ? line->chars[x - 1].data : ' ';
|
|
||||||
unsigned char next_char = x < line->length - 1 ? line->chars[x + 1].data : ' ';
|
|
||||||
unsigned char up_char = (prev_line && x < prev_line->length) ? prev_line->chars[x].data : ' ';
|
|
||||||
unsigned char down_char = (next_line && x < next_line->length) ? next_line->chars[x].data : ' ';
|
|
||||||
#endif
|
|
||||||
switch (ch) {
|
|
||||||
case '+':
|
|
||||||
dir = 0;
|
|
||||||
if (up_char == '|' || up_char == BORDER_SVLINE) dir |= 1;
|
|
||||||
if (next_char == '-' || next_char == BORDER_SHLINE) dir |= 2;
|
|
||||||
if (down_char == '|' || down_char == BORDER_SVLINE) dir |= 4;
|
|
||||||
if (prev_char == '-' || prev_char == BORDER_SHLINE) dir |= 8;
|
|
||||||
|
|
||||||
switch (dir) {
|
prev_char = x > 0 ? line->chars[x - 1].data : ' ';
|
||||||
case 15:
|
next_char = x < line->length - 1 ? line->chars[x + 1].data : ' ';
|
||||||
line->chars[x].data = BORDER_SCROSS;
|
up_char = (prev_line && x < prev_line->length) ? prev_line->chars[x].data : ' ';
|
||||||
line->chars[x].attr = SCREEN_ATTR_FRAME;
|
down_char = (next_line && x < next_line->length) ? next_line->chars[x].data : ' ';
|
||||||
break;
|
|
||||||
case 13:
|
switch (ch) {
|
||||||
line->chars[x].data = BORDER_SLTEE;
|
case '+':
|
||||||
line->chars[x].attr = SCREEN_ATTR_FRAME;
|
dir = 0;
|
||||||
break;
|
if (up_char == '|' || up_char == BORDER_SVLINE) dir |= 1;
|
||||||
case 7:
|
if (next_char == '-' || next_char == BORDER_SHLINE) dir |= 2;
|
||||||
line->chars[x].data = BORDER_SRTEE;
|
if (down_char == '|' || down_char == BORDER_SVLINE) dir |= 4;
|
||||||
line->chars[x].attr = SCREEN_ATTR_FRAME;
|
if (prev_char == '-' || prev_char == BORDER_SHLINE) dir |= 8;
|
||||||
break;
|
|
||||||
case 6:
|
switch (dir) {
|
||||||
line->chars[x].data = BORDER_SULCORNER;
|
case 15:
|
||||||
line->chars[x].attr = SCREEN_ATTR_FRAME;
|
line->chars[x].data = BORDER_SCROSS;
|
||||||
break;
|
line->chars[x].attr = SCREEN_ATTR_FRAME;
|
||||||
case 12:
|
|
||||||
line->chars[x].data = BORDER_SURCORNER;
|
|
||||||
line->chars[x].attr = SCREEN_ATTR_FRAME;
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
line->chars[x].data = BORDER_SDLCORNER;
|
|
||||||
line->chars[x].attr = SCREEN_ATTR_FRAME;
|
|
||||||
break;
|
|
||||||
case 9:
|
|
||||||
line->chars[x].data = BORDER_SDRCORNER;
|
|
||||||
line->chars[x].attr = SCREEN_ATTR_FRAME;
|
|
||||||
break;
|
|
||||||
case 11:
|
|
||||||
line->chars[x].data = BORDER_SUTEE;
|
|
||||||
line->chars[x].attr = SCREEN_ATTR_FRAME;
|
|
||||||
break;
|
|
||||||
case 14:
|
|
||||||
line->chars[x].data = BORDER_SDTEE;
|
|
||||||
line->chars[x].attr = SCREEN_ATTR_FRAME;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case '-':
|
case 13:
|
||||||
if (prev_char == BORDER_SHLINE || prev_char == BORDER_SCROSS || prev_char == '+' || prev_char == '|'
|
line->chars[x].data = BORDER_SLTEE;
|
||||||
|| prev_char == BORDER_SULCORNER || prev_char == BORDER_SDLCORNER || prev_char == BORDER_SRTEE
|
line->chars[x].attr = SCREEN_ATTR_FRAME;
|
||||||
|| prev_char == BORDER_SUTEE || prev_char == BORDER_SDTEE) {
|
|
||||||
line->chars[x].data = BORDER_SHLINE;
|
|
||||||
line->chars[x].attr = SCREEN_ATTR_FRAME;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case '|':
|
case 7:
|
||||||
if (up_char == BORDER_SVLINE || up_char == '+' || up_char == '|' || up_char == BORDER_SULCORNER
|
line->chars[x].data = BORDER_SRTEE;
|
||||||
|| up_char == BORDER_SURCORNER || up_char == BORDER_SCROSS || up_char == BORDER_SRTEE || up_char == BORDER_SLTEE
|
line->chars[x].attr = SCREEN_ATTR_FRAME;
|
||||||
|| up_char == BORDER_SDTEE) {
|
break;
|
||||||
if (next_char == '-') {
|
case 6:
|
||||||
line->chars[x].data = BORDER_SRTEE;
|
line->chars[x].data = BORDER_SULCORNER;
|
||||||
} else if (prev_char == BORDER_SHLINE || prev_char == '-') {
|
line->chars[x].attr = SCREEN_ATTR_FRAME;
|
||||||
line->chars[x].data = BORDER_SLTEE;
|
break;
|
||||||
} else {
|
case 12:
|
||||||
line->chars[x].data = BORDER_SVLINE;
|
line->chars[x].data = BORDER_SURCORNER;
|
||||||
}
|
line->chars[x].attr = SCREEN_ATTR_FRAME;
|
||||||
line->chars[x].attr = SCREEN_ATTR_FRAME;
|
break;
|
||||||
}
|
case 3:
|
||||||
|
line->chars[x].data = BORDER_SDLCORNER;
|
||||||
|
line->chars[x].attr = SCREEN_ATTR_FRAME;
|
||||||
|
break;
|
||||||
|
case 9:
|
||||||
|
line->chars[x].data = BORDER_SDRCORNER;
|
||||||
|
line->chars[x].attr = SCREEN_ATTR_FRAME;
|
||||||
|
break;
|
||||||
|
case 11:
|
||||||
|
line->chars[x].data = BORDER_SUTEE;
|
||||||
|
line->chars[x].attr = SCREEN_ATTR_FRAME;
|
||||||
|
break;
|
||||||
|
case 14:
|
||||||
|
line->chars[x].data = BORDER_SDTEE;
|
||||||
|
line->chars[x].attr = SCREEN_ATTR_FRAME;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
continue;
|
break;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
case '-':
|
||||||
|
if (prev_char == BORDER_SHLINE || prev_char == BORDER_SCROSS || prev_char == '+' || prev_char == '|'
|
||||||
|
|| prev_char == BORDER_SULCORNER || prev_char == BORDER_SDLCORNER || prev_char == BORDER_SRTEE
|
||||||
|
|| prev_char == BORDER_SUTEE || prev_char == BORDER_SDTEE) {
|
||||||
|
line->chars[x].data = BORDER_SHLINE;
|
||||||
|
line->chars[x].attr = SCREEN_ATTR_FRAME;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case '|':
|
||||||
|
if (up_char == BORDER_SVLINE || up_char == '+' || up_char == '|' || up_char == BORDER_SULCORNER
|
||||||
|
|| up_char == BORDER_SURCORNER || up_char == BORDER_SCROSS || up_char == BORDER_SRTEE || up_char == BORDER_SLTEE
|
||||||
|
|| up_char == BORDER_SDTEE) {
|
||||||
|
if (next_char == '-') {
|
||||||
|
line->chars[x].data = BORDER_SRTEE;
|
||||||
|
} else if (prev_char == BORDER_SHLINE || prev_char == '-') {
|
||||||
|
line->chars[x].data = BORDER_SLTEE;
|
||||||
|
} else {
|
||||||
|
line->chars[x].data = BORDER_SVLINE;
|
||||||
|
}
|
||||||
|
line->chars[x].attr = SCREEN_ATTR_FRAME;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user