diff options
| author | Berke Güzel <wenekar1@gmail.com> | 2026-10-15 12:30:14 +0300 |
|---|---|---|
| committer | Berke Güzel <wenekar1@gmail.com> | 2026-10-15 12:30:14 +0300 |
| commit | 7ed78a31debb0250bae16d8b4098a4689f29bb60 (patch) | |
| tree | eda4e03a9c51140f78ef6e8c9f73ebcd0d8eca8b /tests/model.c | |
| parent | 5f03033b0e211f9ed13e7a1351f9a8f9011ab665 (diff) | |
Take the terminal name from term_options.name
The core hard-coded "wsap_term" for XTVERSION, the XTGETTCAP TN and
name default, and the OSC 9 notification title. A headless library
should take its identity from the host.
term_options.name sets the name. NULL or "" selects "term". term_new()
copies it and returns NULL unless it is 1 to 63 printable ASCII bytes,
since DCS replies echo it. A DCS +p still changes the TN value, and
the XTVERSION and notification defaults keep the host name.
Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Diffstat (limited to 'tests/model.c')
| -rw-r--r-- | tests/model.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/model.c b/tests/model.c index 8dead6c..b538ba1 100644 --- a/tests/model.c +++ b/tests/model.c @@ -72,6 +72,7 @@ enum { GROUND, ESC, CSI, STR, STR_ESC, CHARSET, HASH, DOCS }; enum { OSC, DCS, IGNORE }; struct model { + char name[64]; /* XTVERSION reply */ int cols, rows, limit; struct row **scr; struct row **hist; @@ -1625,7 +1626,7 @@ static void csi_dispatch(struct model *m, unsigned char final) break; case 'q': if (m->prefix == '>' && !m->inter && (!m->nparam || !m->param[0])) { - reply(m, "\033P>|wsap_term\033\\"); + reply(m, "\033P>|%s\033\\", m->name); } else if (!m->prefix && m->inter == ' ') { int ps = m->nparam ? m->param[0] : 0; if (ps == 0) { @@ -1971,10 +1972,11 @@ static void feed_byte(struct model *m, unsigned char c) /* ---- public ---- */ -struct model *model_new(struct term_vector2i size, int history) +struct model *model_new(struct term_vector2i size, int history, const char *name) { struct model *m = calloc(1, sizeof(*m)); if (!m) abort(); + snprintf(m->name, sizeof(m->name), "%s", name && *name ? name : "term"); m->cols = size.x < 1 ? 80 : size.x; m->rows = size.y < 1 ? 24 : size.y; m->limit = history_limit(history); |
