Make GRAPHIC select the text plane
Some checks failed
akbasic CI Build / cmake_build (push) Failing after 3m22s
akbasic CI Build / sanitizers (push) Failing after 4m43s
akbasic CI Build / coverage (push) Failing after 3m43s
akbasic CI Build / akgl_build (push) Failing after 4m48s
akbasic CI Build / mutation_test (push) Failing after 3m31s

Co-authored-by: Andrew Kesterson <andrew@aklabs.net>
This commit is contained in:
2026-08-03 08:08:34 -04:00
parent c5d13f00f6
commit 3342f2b569
13 changed files with 345 additions and 79 deletions

View File

@@ -143,6 +143,22 @@ static akerr_ErrorContext *tee_window(akbasic_TextSink *self, int left, int top,
SUCCEED_RETURN(errctx);
}
/** @brief Forward GRAPHIC's display-mode decision to the half with a display. */
static akerr_ErrorContext *tee_graphic(akbasic_TextSink *self, int mode, int split)
{
PREPARE_ERROR(errctx);
akbasic_TeeSink *state = NULL;
PASS(errctx, tee_state(self, &state));
if ( state->primary != NULL && state->primary->graphic != NULL ) {
PASS(errctx, state->primary->graphic(state->primary, mode, split));
}
if ( state->mirror != NULL && state->mirror->graphic != NULL ) {
PASS(errctx, state->mirror->graphic(state->mirror, mode, split));
}
SUCCEED_RETURN(errctx);
}
/**
* @brief Report the grid of whichever half has one.
*
@@ -202,6 +218,7 @@ akerr_ErrorContext *akbasic_sink_init_tee(akbasic_TextSink *obj, akbasic_TeeSink
obj->moveto = NULL;
obj->window = NULL;
obj->grid = NULL;
obj->graphic = NULL;
/*
* Offered only when a half can actually do it, so CHAR's refusal against a
* stdio-only driver still reads correctly through a tee.
@@ -221,5 +238,9 @@ akerr_ErrorContext *akbasic_sink_init_tee(akbasic_TextSink *obj, akbasic_TeeSink
(mirror != NULL && mirror->grid != NULL) ) {
obj->grid = tee_grid;
}
if ( (primary != NULL && primary->graphic != NULL) ||
(mirror != NULL && mirror->graphic != NULL) ) {
obj->graphic = tee_graphic;
}
SUCCEED_RETURN(errctx);
}