This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch missed-commit
in repository terminology.
View the commit online.
commit 4d3063fdd731e66ebffa83c7e4a73785b4594a45
Author: [email protected] <[email protected]>
AuthorDate: Tue Apr 28 22:26:38 2026 -0600
refactor: split termpty_cellrow_get into const read + writeable accessors
Separates renderer reads from parser writes so future work can safely
intercept either side. The new const termpty_cellrow_get() is called by
readers; the mutable termpty_cellrow_get_writeable() is called by writers
(parser ops, mouse highlight). A static _termpty_cellrow_live_get() helper
isolates the live-cell lookup logic.
This const propagation verifies at compile time that all readers
(selection, link detection, rendering, miniview) access cells through
the read-only path and cannot mutate the snapshot taken during
Synchronized Output.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
---
src/bin/miniview.c | 2 +-
src/bin/termio.c | 4 ++--
src/bin/termiointernals.c | 14 +++++++-------
src/bin/termiolink.c | 6 +++---
src/bin/termpty.c | 2 +-
src/bin/termpty.h | 9 +++++----
src/bin/termptyext.c | 2 +-
src/bin/termptyops.c | 6 ++++--
src/bin/termptyops.h | 2 +-
9 files changed, 25 insertions(+), 22 deletions(-)
diff --git a/src/bin/miniview.c b/src/bin/miniview.c
index 9ab42023..6dd56ede 100644
--- a/src/bin/miniview.c
+++ b/src/bin/miniview.c
@@ -555,7 +555,7 @@ _deferred_renderer(void *data)
for (y = 0; y < mv->img_h; y++)
{
- Termcell *cells = termpty_cellrow_get(ty, mv->img_hist + y, &wret);
+ const Termcell *cells = termpty_cellrow_get(ty, mv->img_hist + y, &wret);
if (!cells)
break;
diff --git a/src/bin/termio.c b/src/bin/termio.c
index 33aa893e..77bca231 100644
--- a/src/bin/termio.c
+++ b/src/bin/termio.c
@@ -1807,7 +1807,7 @@ _hyperlink_mouseover(Termio *sd,
termpty_backscroll_adjust(sd->pty, &sd->scroll);
for (y = 0; y < sd->grid.h; y++)
{
- Termcell *cells;
+ const Termcell *cells;
Evas_Object *o;
ssize_t w = 0;
int start_x = -1;
@@ -1820,7 +1820,7 @@ _hyperlink_mouseover(Termio *sd,
continue;
for (x = 0; x < w; x++)
{
- Termcell *c = cells + x;
+ const Termcell *c = cells + x;
if (term_link_eq(sd->pty, hl, c->att.link_id))
{
if (!o)
diff --git a/src/bin/termiointernals.c b/src/bin/termiointernals.c
index ad851282..5acf80e4 100644
--- a/src/bin/termiointernals.c
+++ b/src/bin/termiointernals.c
@@ -37,7 +37,7 @@ termio_selection_get(Termio *sd,
termpty_backlog_lock();
for (y = c1y; y <= c2y; y++)
{
- Termcell *cells;
+ const Termcell *cells;
ssize_t w;
int last0, v, start_x, end_x;
@@ -274,7 +274,7 @@ _sel_codepoints_get(const Termio *sd,
termpty_backlog_lock();
for (y = c1y; y <= c2y; y++)
{
- Termcell *cells;
+ const Termcell *cells;
ssize_t w = 0;
int start_x, end_x;
@@ -824,7 +824,7 @@ static void
_trim_sel_word(Termio *sd)
{
Termpty *pty = sd->pty;
- Termcell *cells;
+ const Termcell *cells;
int start = 0, end = 0, y = 0;
ssize_t w;
@@ -893,7 +893,7 @@ _trim_sel_word(Termio *sd)
static void
_sel_word(Termio *sd, int cx, int cy)
{
- Termcell *cells;
+ const Termcell *cells;
int x, y;
ssize_t w = 0;
Eina_Bool done = EINA_FALSE;
@@ -951,7 +951,7 @@ _sel_word(Termio *sd, int cx, int cy)
}
if (!done)
{
- Termcell *old_cells = cells;
+ const Termcell *old_cells = cells;
size_t old_w = w;
cells = termpty_cellrow_get(sd->pty, y - 1, &w);
@@ -1361,7 +1361,7 @@ termio_selection_dbl_fix(Termio *sd)
{
int start_x, start_y, end_x, end_y;
ssize_t w = 0;
- Termcell *cells;
+ const Termcell *cells;
/* Only change the end position */
EINA_SAFETY_ON_NULL_RETURN(sd);
@@ -2430,7 +2430,7 @@ termio_internal_render(Termio *sd,
/* Look at every visible line */
for (y = 0; y < sd->grid.h; y++)
{
- Termcell *cells;
+ const Termcell *cells;
Evas_Textgrid_Cell *tc;
Eina_Unicode *cp = NULL;
int cur_sel_start_x = -1, cur_sel_end_x = -1;
diff --git a/src/bin/termiolink.c b/src/bin/termiolink.c
index 1035a42d..1a18a342 100644
--- a/src/bin/termiolink.c
+++ b/src/bin/termiolink.c
@@ -243,7 +243,7 @@ link_is_file(const char *str)
static int
_txt_at(Termpty *ty, int *x, int *y, char *txt, int *txtlenp, int *codepointp)
{
- Termcell *cells = NULL;
+ const Termcell *cells = NULL;
Termcell cell;
ssize_t w;
@@ -292,7 +292,7 @@ static int
_txt_prev_at(Termpty *ty, int *x, int *y, char *txt, int *txtlenp,
int *codepointp)
{
- Termcell *cells = NULL;
+ const Termcell *cells = NULL;
Termcell cell;
ssize_t w;
@@ -367,7 +367,7 @@ static int
_txt_next_at(Termpty *ty, int *x, int *y, char *txt, int *txtlenp,
int *codepointp)
{
- Termcell *cells = NULL;
+ const Termcell *cells = NULL;
Termcell cell;
ssize_t w;
diff --git a/src/bin/termpty.c b/src/bin/termpty.c
index 755859a4..5f2b2385 100644
--- a/src/bin/termpty.c
+++ b/src/bin/termpty.c
@@ -1073,7 +1073,7 @@ ssize_t
termpty_row_length(Termpty *ty, int y)
{
ssize_t wret;
- Termcell *cells = termpty_cellrow_get(ty, y, &wret);
+ const Termcell *cells = termpty_cellrow_get(ty, y, &wret);
if (!cells)
return 0;
diff --git a/src/bin/termpty.h b/src/bin/termpty.h
index ba0376f6..c24a25b7 100644
--- a/src/bin/termpty.h
+++ b/src/bin/termpty.h
@@ -305,9 +305,10 @@ void termpty_sync_output_reset(Termpty *ty);
void termpty_sync_output_snapshot_free(Termpty *ty);
void termpty_config_update(Termpty *ty, Config *config);
-Termcell *termpty_cellrow_get(Termpty *ty, int y, ssize_t *wret);
-Termcell * termpty_cell_get(Termpty *ty, int y_requested, int x_requested);
-ssize_t termpty_row_length(Termpty *ty, int y);
+const Termcell *termpty_cellrow_get(Termpty *ty, int y, ssize_t *wret);
+Termcell *termpty_cellrow_get_writeable(Termpty *ty, int y, ssize_t *wret);
+Termcell *termpty_cell_get(Termpty *ty, int y_requested, int x_requested);
+ssize_t termpty_row_length(Termpty *ty, int y);
#define TERMPTY_WRITE_STR(S_) \
termpty_write(ty, S_, strlen(S_))
@@ -433,7 +434,7 @@ term_link_eq(Termpty *ty, Term_Link *hl, uint16_t link_id)
}
static inline void
-termpty_cell_fill(Termpty *ty, Termcell *src, Termcell *dst, int n)
+termpty_cell_fill(Termpty *ty, const Termcell *src, Termcell *dst, int n)
{
int i;
diff --git a/src/bin/termptyext.c b/src/bin/termptyext.c
index ebe4cd77..88ef3148 100644
--- a/src/bin/termptyext.c
+++ b/src/bin/termptyext.c
@@ -328,7 +328,7 @@ _handle_link(Termpty *ty, const Eina_Unicode *buf)
Termcell *cells = NULL;
ssize_t w;
- cells = termpty_cellrow_get(ty, sd->mouse.cy, &w);
+ cells = termpty_cellrow_get_writeable(ty, sd->mouse.cy, &w);
termpty_reset_att(&cells[sd->mouse.cx].att);
cells[sd->mouse.cx].att.bold = 1;
cells[sd->mouse.cx].att.fg = COL_WHITE;
diff --git a/src/bin/termptyops.c b/src/bin/termptyops.c
index b60db82a..2e0fec93 100644
--- a/src/bin/termptyops.c
+++ b/src/bin/termptyops.c
@@ -498,6 +498,8 @@ termpty_move_cursor(Termpty *ty, int cx, int cy)
{
int cur_cx = ty->cursor_state.cx;
int cur_cy = ty->cursor_state.cy;
+ /* Use the writeable (live) accessor: autowrapped is a parser-semantic flag
+ * that must reflect the current live state, not any sync snapshot. */
Termcell *cells;
ssize_t wlen;
int n_to_down = 0;
@@ -509,7 +511,7 @@ termpty_move_cursor(Termpty *ty, int cx, int cy)
if (cur_cy < cy)
{
/* go down */
- cells = termpty_cellrow_get(ty, cur_cy, &wlen);
+ cells = termpty_cellrow_get_writeable(ty, cur_cy, &wlen);
assert(cells);
if (cells[wlen-1].att.autowrapped)
{
@@ -524,7 +526,7 @@ termpty_move_cursor(Termpty *ty, int cx, int cy)
else
{
/* go up */
- cells = termpty_cellrow_get(ty, cur_cy - 1, &wlen);
+ cells = termpty_cellrow_get_writeable(ty, cur_cy - 1, &wlen);
assert(cells);
if (cells[wlen-1].att.autowrapped)
{
diff --git a/src/bin/termptyops.h b/src/bin/termptyops.h
index e041c8b8..5ae2eb01 100644
--- a/src/bin/termptyops.h
+++ b/src/bin/termptyops.h
@@ -9,7 +9,7 @@ typedef enum tag_Termpty_Clear
} Termpty_Clear;
void termpty_text_save_top(Termpty *ty, Termcell *cells, ssize_t w_max);
-void termpty_cells_copy(Termpty *ty, Termcell *cells, Termcell *dest, int count);
+void termpty_cells_copy(Termpty *ty, const Termcell *cells, Termcell *dest, int count);
void termpty_cells_clear(Termpty *ty, Termcell *cells, int count);
void termpty_cells_att_fill_preserve_colors(Termpty *ty, Termcell *cells,
Eina_Unicode codepoint, int count);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.