mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-31 07:11:09 -04:00
vt: free OSC buffer after dispatch, if larger than 4K
This commit is contained in:
parent
1e63dddb89
commit
0b9b726bdf
1 changed files with 12 additions and 3 deletions
15
vt.c
15
vt.c
|
|
@ -577,11 +577,20 @@ action_osc_start(struct terminal *term, uint8_t c)
|
||||||
static void
|
static void
|
||||||
action_osc_end(struct terminal *term, uint8_t c)
|
action_osc_end(struct terminal *term, uint8_t c)
|
||||||
{
|
{
|
||||||
if (!osc_ensure_size(term, term->vt.osc.idx + 1))
|
struct vt *vt = &term->vt;
|
||||||
|
|
||||||
|
if (!osc_ensure_size(term, vt->osc.idx + 1))
|
||||||
return;
|
return;
|
||||||
term->vt.osc.data[term->vt.osc.idx] = '\0';
|
|
||||||
term->vt.osc.bel = c == '\a';
|
vt->osc.data[vt->osc.idx] = '\0';
|
||||||
|
vt->osc.bel = c == '\a';
|
||||||
osc_dispatch(term);
|
osc_dispatch(term);
|
||||||
|
|
||||||
|
if (unlikely(vt->osc.idx >= 4096)) {
|
||||||
|
free(vt->osc.data);
|
||||||
|
vt->osc.data = NULL;
|
||||||
|
vt->osc.size = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue