ul: flip comparisons to lesser to greater order

1 < 2 < x < 4 is the order is the natural of values.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
Sami Kerola 2020-10-16 22:35:06 +01:00
parent 0186ff364d
commit 1a3f71b292
No known key found for this signature in database
GPG Key ID: 0D46FEF7E61DBB46
1 changed files with 11 additions and 11 deletions

View File

@ -352,7 +352,7 @@ static void overstrike(struct ul_ctl *ctl)
break;
case BOLD:
*p++ = ctl->buf[i].c_char;
if (ctl->buf[i].c_width > 1)
if (1 < ctl->buf[i].c_width)
i += ctl->buf[i].c_width - 1;
had_bold = 1;
break;
@ -392,7 +392,7 @@ static void flush_line(struct ul_ctl *ctl, struct term_caps const *const tcs)
output_char(ctl, tcs, ' ', 1);
} else
output_char(ctl, tcs, ctl->buf[i].c_char, ctl->buf[i].c_width);
if (ctl->buf[i].c_width > 1)
if (1 < ctl->buf[i].c_width)
i += ctl->buf[i].c_width - 1;
}
if (last_mode != NORMAL_CHARSET)
@ -434,24 +434,24 @@ static int handle_escape(struct ul_ctl *ctl, struct term_caps const *const tcs,
switch (c = getwc(f)) {
case HREV:
if (ctl->half_position == 0) {
ctl->mode |= SUPERSCRIPT;
ctl->half_position--;
} else if (ctl->half_position > 0) {
if (0 < ctl->half_position) {
ctl->mode &= ~SUBSCRIPT;
ctl->half_position--;
} else if (ctl->half_position == 0) {
ctl->mode |= SUPERSCRIPT;
ctl->half_position--;
} else {
ctl->half_position = 0;
reverse(ctl, tcs);
}
return 0;
case HFWD:
if (ctl->half_position == 0) {
ctl->mode |= SUBSCRIPT;
ctl->half_position++;
} else if (ctl->half_position < 0) {
if (ctl->half_position < 0) {
ctl->mode &= ~SUPERSCRIPT;
ctl->half_position++;
} else if (ctl->half_position == 0) {
ctl->mode |= SUBSCRIPT;
ctl->half_position++;
} else {
ctl->half_position = 0;
forward(ctl, tcs);
@ -498,7 +498,7 @@ static void filter(struct ul_ctl *ctl, struct term_caps const *const tcs, FILE *
continue;
case '_':
if (ctl->buf[ctl->column].c_char || ctl->buf[ctl->column].c_width < 0) {
while (ctl->column > 0 && ctl->buf[ctl->column].c_width < 0)
while (ctl->buf[ctl->column].c_width < 0 && 0 < ctl->column)
ctl->column--;
width = ctl->buf[ctl->column].c_width;
for (i = 0; i < width; i++)