mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-22 01:40:17 -05:00
term: add term_put_char()
This function prints a single, non-double width, character to the grid. It handles OSC-8 hyperlinks, but does not: * update the cursor location * erase sixels
This commit is contained in:
parent
3e6f0e63f3
commit
ea851962c1
2 changed files with 37 additions and 0 deletions
36
terminal.c
36
terminal.c
|
|
@ -3498,6 +3498,42 @@ print_spacer(struct terminal *term, int col, int remaining)
|
||||||
cell->attrs = term->vt.attrs;
|
cell->attrs = term->vt.attrs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Puts a character on the grid. Coordinates are in screen coordinates
|
||||||
|
* (i.e. ‘cursor’ coordinates).
|
||||||
|
*
|
||||||
|
* Does NOT:
|
||||||
|
* - update the cursor
|
||||||
|
* - linewrap
|
||||||
|
* - erase sixels
|
||||||
|
*
|
||||||
|
* Limitiations:
|
||||||
|
* - double width characters not supported
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
term_put_char(struct terminal *term, int r, int c, wchar_t wc)
|
||||||
|
{
|
||||||
|
struct row *row = grid_row(term->grid, r);
|
||||||
|
row->dirty = true;
|
||||||
|
|
||||||
|
struct cell *cell = &row->cells[c];
|
||||||
|
cell->wc = wc;
|
||||||
|
cell->attrs = term->vt.attrs;
|
||||||
|
|
||||||
|
if (unlikely(term->vt.osc8.uri != NULL)) {
|
||||||
|
grid_row_uri_range_put(row, c, term->vt.osc8.uri, term->vt.osc8.id);
|
||||||
|
|
||||||
|
switch (term->conf->url.osc8_underline) {
|
||||||
|
case OSC8_UNDERLINE_ALWAYS:
|
||||||
|
cell->attrs.url = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case OSC8_UNDERLINE_URL_MODE:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
term_print(struct terminal *term, char32_t wc, int width)
|
term_print(struct terminal *term, char32_t wc, int width)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -797,6 +797,7 @@ void term_cursor_up(struct terminal *term, int count);
|
||||||
void term_cursor_down(struct terminal *term, int count);
|
void term_cursor_down(struct terminal *term, int count);
|
||||||
void term_cursor_blink_update(struct terminal *term);
|
void term_cursor_blink_update(struct terminal *term);
|
||||||
|
|
||||||
|
void term_put_char(struct terminal *term, int r, int c, char32_t wc);
|
||||||
void term_print(struct terminal *term, char32_t wc, int width);
|
void term_print(struct terminal *term, char32_t wc, int width);
|
||||||
|
|
||||||
void term_scroll(struct terminal *term, int rows);
|
void term_scroll(struct terminal *term, int rows);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue