mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
term: move lcf flag into 'cursor' struct
This commit is contained in:
parent
d637b8c9ba
commit
a70fe1f5d7
4 changed files with 16 additions and 16 deletions
18
csi.c
18
csi.c
|
|
@ -413,13 +413,13 @@ csi_dispatch(struct terminal *term, uint8_t final)
|
|||
term,
|
||||
&term->cursor.point,
|
||||
&(struct coord){term->cols - 1, term->rows - 1});
|
||||
term->lcf = false;
|
||||
term->cursor.lcf = false;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
/* From start of screen to cursor */
|
||||
term_erase(term, &(struct coord){0, 0}, &term->cursor.point);
|
||||
term->lcf = false;
|
||||
term->cursor.lcf = false;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
|
|
@ -428,7 +428,7 @@ csi_dispatch(struct terminal *term, uint8_t final)
|
|||
term,
|
||||
&(struct coord){0, 0},
|
||||
&(struct coord){term->cols - 1, term->rows - 1});
|
||||
term->lcf = false;
|
||||
term->cursor.lcf = false;
|
||||
break;
|
||||
|
||||
case 3: {
|
||||
|
|
@ -471,14 +471,14 @@ csi_dispatch(struct terminal *term, uint8_t final)
|
|||
term,
|
||||
&term->cursor.point,
|
||||
&(struct coord){term->cols - 1, term->cursor.point.row});
|
||||
term->lcf = false;
|
||||
term->cursor.lcf = false;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
/* From start of line to cursor */
|
||||
term_erase(
|
||||
term, &(struct coord){0, term->cursor.point.row}, &term->cursor.point);
|
||||
term->lcf = false;
|
||||
term->cursor.lcf = false;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
|
|
@ -487,7 +487,7 @@ csi_dispatch(struct terminal *term, uint8_t final)
|
|||
term,
|
||||
&(struct coord){0, term->cursor.point.row},
|
||||
&(struct coord){term->cols - 1, term->cursor.point.row});
|
||||
term->lcf = false;
|
||||
term->cursor.lcf = false;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
@ -558,7 +558,7 @@ csi_dispatch(struct terminal *term, uint8_t final)
|
|||
term,
|
||||
&(struct coord){term->cursor.point.col + remaining, term->cursor.point.row},
|
||||
&(struct coord){term->cols - 1, term->cursor.point.row});
|
||||
term->lcf = false;
|
||||
term->cursor.lcf = false;
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -585,7 +585,7 @@ csi_dispatch(struct terminal *term, uint8_t final)
|
|||
term,
|
||||
&term->cursor.point,
|
||||
&(struct coord){term->cursor.point.col + count - 1, term->cursor.point.row});
|
||||
term->lcf = false;
|
||||
term->cursor.lcf = false;
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -606,7 +606,7 @@ csi_dispatch(struct terminal *term, uint8_t final)
|
|||
term,
|
||||
&term->cursor.point,
|
||||
&(struct coord){term->cursor.point.col + count - 1, term->cursor.point.row});
|
||||
term->lcf = false;
|
||||
term->cursor.lcf = false;
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -855,7 +855,7 @@ term_reset(struct terminal *term, bool hard)
|
|||
term->colors.bg = term->colors.default_bg;
|
||||
for (size_t i = 0; i < 256; i++)
|
||||
term->colors.table[i] = term->colors.default_table[i];
|
||||
term->lcf = false;
|
||||
term->cursor.lcf = false;
|
||||
term->cursor = (struct cursor){.point = {0, 0}};
|
||||
term->saved_cursor = (struct cursor){.point = {0, 0}};
|
||||
term->alt_saved_cursor = (struct cursor){.point = {0, 0}};
|
||||
|
|
@ -1024,7 +1024,7 @@ term_cursor_to(struct terminal *term, int row, int col)
|
|||
assert(row < term->rows);
|
||||
assert(col < term->cols);
|
||||
|
||||
term->lcf = false;
|
||||
term->cursor.lcf = false;
|
||||
|
||||
term->cursor.point.col = col;
|
||||
term->cursor.point.row = row;
|
||||
|
|
@ -1045,7 +1045,7 @@ term_cursor_left(struct terminal *term, int count)
|
|||
int move_amount = min(term->cursor.point.col, count);
|
||||
term->cursor.point.col -= move_amount;
|
||||
assert(term->cursor.point.col >= 0);
|
||||
term->lcf = false;
|
||||
term->cursor.lcf = false;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -1054,7 +1054,7 @@ term_cursor_right(struct terminal *term, int count)
|
|||
int move_amount = min(term->cols - term->cursor.point.col - 1, count);
|
||||
term->cursor.point.col += move_amount;
|
||||
assert(term->cursor.point.col < term->cols);
|
||||
term->lcf = false;
|
||||
term->cursor.lcf = false;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -63,6 +63,7 @@ struct coord {
|
|||
|
||||
struct cursor {
|
||||
struct coord point;
|
||||
bool lcf;
|
||||
};
|
||||
|
||||
enum damage_type {DAMAGE_SCROLL, DAMAGE_SCROLL_REVERSE,
|
||||
|
|
@ -205,7 +206,6 @@ struct terminal {
|
|||
int cell_width; /* pixels per cell, x-wise */
|
||||
int cell_height; /* pixels per cell, y-wise */
|
||||
|
||||
bool lcf;
|
||||
struct scroll_region scroll_region;
|
||||
|
||||
struct {
|
||||
|
|
|
|||
4
vt.c
4
vt.c
|
|
@ -713,7 +713,7 @@ esc_dispatch(struct terminal *term, uint8_t final)
|
|||
static inline void
|
||||
pre_print(struct terminal *term)
|
||||
{
|
||||
if (unlikely(term->lcf) && term->auto_margin) {
|
||||
if (unlikely(term->cursor.lcf) && term->auto_margin) {
|
||||
if (term->cursor.point.row == term->scroll_region.end - 1) {
|
||||
term_scroll(term, 1);
|
||||
term_cursor_to(term, term->cursor.point.row, 0);
|
||||
|
|
@ -728,7 +728,7 @@ post_print(struct terminal *term)
|
|||
if (term->cursor.point.col < term->cols - 1)
|
||||
term_cursor_right(term, 1);
|
||||
else
|
||||
term->lcf = true;
|
||||
term->cursor.lcf = true;
|
||||
}
|
||||
|
||||
static inline void
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue