aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/doc.c
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2021-10-11 08:43:33 +0300
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2021-10-11 08:43:33 +0300
commit8baa1b3ebe163de3a55696e50d49f160529473b3 (patch)
treec7d54d763c5743765206ab125fffc28cea9d95d6 /src/doc.c
parent6e67f5a682ff46d69888fec61b94bf45cec46721 (diff)
downloadsciteco-8baa1b3ebe163de3a55696e50d49f160529473b3.tar.gz
optimized character representation setting
* Esp. with the new Scintilla version, the representation setting as part of every SCI_SETDOCPOINTER has turned out to be a performance bottleneck. * The new Scintilla has a custom tweak/patch that disables any automatic representation setting in Scintilla itself. It is now sufficient to initialize the SciTECO-style representations only once in the lifetime of any view.
Diffstat (limited to 'src/doc.c')
-rw-r--r--src/doc.c31
1 files changed, 6 insertions, 25 deletions
diff --git a/src/doc.c b/src/doc.c
index 41acf40..9485f13 100644
--- a/src/doc.c
+++ b/src/doc.c
@@ -41,19 +41,6 @@ teco_doc_get_scintilla(teco_doc_t *ctx)
void
teco_doc_edit(teco_doc_t *ctx)
{
- /*
- * FIXME: SCI_SETREPRESENTATION does not redraw
- * the screen - also that would be very slow.
- * Since SCI_SETDOCPOINTER resets the representation
- * (this should probably be fixed in Scintilla),
- * the screen is garbled since the layout cache
- * is calculated with the default representations.
- * We work around this by temporarily disabling the
- * layout cache.
- */
- gint old_mode = teco_view_ssm(teco_qreg_view, SCI_GETLAYOUTCACHE, 0, 0);
- teco_view_ssm(teco_qreg_view, SCI_SETLAYOUTCACHE, SC_CACHE_NONE, 0);
-
teco_view_ssm(teco_qreg_view, SCI_SETDOCPOINTER, 0,
(sptr_t)teco_doc_get_scintilla(ctx));
teco_view_ssm(teco_qreg_view, SCI_SETFIRSTVISIBLELINE, ctx->first_line, 0);
@@ -61,12 +48,11 @@ teco_doc_edit(teco_doc_t *ctx)
teco_view_ssm(teco_qreg_view, SCI_SETSEL, ctx->anchor, (sptr_t)ctx->dot);
/*
- * Default TECO-style character representations.
- * They are reset on EVERY SETDOCPOINTER call by Scintilla.
+ * NOTE: Thanks to a custom Scintilla patch, se representations
+ * do not get reset after SCI_SETDOCPOINTER, so they have to be
+ * initialized only once.
*/
- teco_view_set_representations(teco_qreg_view);
-
- teco_view_ssm(teco_qreg_view, SCI_SETLAYOUTCACHE, old_mode, 0);
+ //teco_view_set_representations(teco_qreg_view);
}
/** @memberof teco_doc_t */
@@ -74,20 +60,15 @@ void
teco_doc_undo_edit(teco_doc_t *ctx)
{
/*
- * FIXME: see above in teco_doc_edit()
+ * NOTE: see above in teco_doc_edit()
*/
- undo__teco_view_ssm(teco_qreg_view, SCI_SETLAYOUTCACHE,
- teco_view_ssm(teco_qreg_view, SCI_GETLAYOUTCACHE, 0, 0), 0);
-
- undo__teco_view_set_representations(teco_qreg_view);
+ //undo__teco_view_set_representations(teco_qreg_view);
undo__teco_view_ssm(teco_qreg_view, SCI_SETSEL, ctx->anchor, (sptr_t)ctx->dot);
undo__teco_view_ssm(teco_qreg_view, SCI_SETXOFFSET, ctx->xoffset, 0);
undo__teco_view_ssm(teco_qreg_view, SCI_SETFIRSTVISIBLELINE, ctx->first_line, 0);
undo__teco_view_ssm(teco_qreg_view, SCI_SETDOCPOINTER, 0,
(sptr_t)teco_doc_get_scintilla(ctx));
-
- undo__teco_view_ssm(teco_qreg_view, SCI_SETLAYOUTCACHE, SC_CACHE_NONE, 0);
}
/** @memberof teco_doc_t */