This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch tymux-10-quiet-head
in repository terminology.
View the commit online.
commit 7d0700ab2fdb454b30f49e91faf640c33618d851
Author: Boris Faure <[email protected]>
AuthorDate: Sun Nov 8 12:20:44 2026 +0000
termpty: update link refcounts once per run when copying cells
Once a hyperlink exists, every cell copy updated the link refcounts of
the source and destination cells one at a time. Text under one link
makes runs of a link id, and the per-cell updates chain on that link's
refcount, the hot spot of scrolling in a scroll region. Update it once
per run. Sources are counted before destinations, so a copy never
frees a link it still holds.
---
src/bin/termpty.h | 51 +++++++++++++++++++++++++++++++++++++--------------
1 file changed, 37 insertions(+), 14 deletions(-)
diff --git a/src/bin/termpty.h b/src/bin/termpty.h
index 53e50882..f35325a6 100644
--- a/src/bin/termpty.h
+++ b/src/bin/termpty.h
@@ -472,20 +472,7 @@ do { \
#define TERMPTY_CELL_COPY(Tpty, Tsrc, Tdst, N) \
do { \
if (EINA_UNLIKELY(((Tpty)->hl.size != 0) || ((Tpty)->block.blocks))) \
- { \
- int __i; \
- \
- for (__i = 0; __i < N; __i++) \
- { \
- HANDLE_BLOCK_CODEPOINT_OVERWRITE(Tpty, \
- (Tdst)[__i].codepoint, \
- (Tsrc)[__i].codepoint); \
- if (EINA_UNLIKELY((Tdst)[__i].att.link_id)) \
- term_link_refcount_dec(Tpty, (Tdst)[__i].att.link_id, 1); \
- if (EINA_UNLIKELY((Tsrc)[__i].att.link_id)) \
- term_link_refcount_inc(Tpty, (Tsrc)[__i].att.link_id, 1); \
- } \
- } \
+ termpty_cells_copy_refs(Tpty, Tsrc, Tdst, N); \
memcpy(Tdst, Tsrc, N * sizeof(Termcell)); \
} while (0)
@@ -510,6 +497,42 @@ term_link_refcount_dec(Termpty *ty, uint16_t link_id, uint16_t count)
term_link_free(ty, link);
}
+/* The block and link references of n cells copied from src over dst.
+ * Links are counted per run of one id: a per-cell update chains every
+ * cell on the same refcount. */
+static inline void
+termpty_cells_copy_refs(Termpty *ty, const Termcell *src, const Termcell *dst,
+ int n)
+{
+ int i, j;
+
+ if (ty->block.blocks)
+ for (i = 0; i < n; i++)
+ HANDLE_BLOCK_CODEPOINT_OVERWRITE(ty, dst[i].codepoint, src[i].codepoint);
+ if (ty->hl.size == 0)
+ return;
+ for (i = 0; i < n; i = j)
+ {
+ uint16_t link_id = src[i].att.link_id;
+
+ j = i + 1;
+ while ((j < n) && (src[j].att.link_id == link_id))
+ j++;
+ if (link_id)
+ term_link_refcount_inc(ty, link_id, j - i);
+ }
+ for (i = 0; i < n; i = j)
+ {
+ uint16_t link_id = dst[i].att.link_id;
+
+ j = i + 1;
+ while ((j < n) && (dst[j].att.link_id == link_id))
+ j++;
+ if (link_id)
+ term_link_refcount_dec(ty, link_id, j - i);
+ }
+}
+
static inline Eina_Bool
term_link_eq(Termpty *ty, Term_Link *hl, uint16_t link_id)
{
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.