aboutsummaryrefslogtreecommitdiff
path: root/terminal.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2021-12-26 13:34:17 +0000
committerDaniel Eklöf <daniel@ekloef.se>2024-03-07 15:24:32 +0000
commitea851962c1f4f1d30e350de3f4aa7bfbea135dcf (patch)
tree1eb812d5047d113eda7398116dfeffafdb3c9499 /terminal.c
parentsixel: don't try to emit a sixel if we're outside the image's boundaries (diff)
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
Diffstat (limited to 'terminal.c')
-rw-r--r--terminal.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/terminal.c b/terminal.c
index d9d66bac..6119f68c 100644
--- a/terminal.c
+++ b/terminal.c
@@ -3498,6 +3498,42 @@ print_spacer(struct terminal *term, int col, int remaining)
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
term_print(struct terminal *term, char32_t wc, int width)
{