aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/doc.c
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2021-10-11 08:51:02 +0300
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2021-10-11 08:51:02 +0300
commit8ef010da59743fcc4927c790f585ba414ec7b129 (patch)
tree88b31b9017abc34d0f94209a997413a22788ef95 /src/doc.c
parent8baa1b3ebe163de3a55696e50d49f160529473b3 (diff)
downloadsciteco-8ef010da59743fcc4927c790f585ba414ec7b129.tar.gz
optimized caret scrolling: this is a costly operation and is now done only once per keypress
* Esp. costly since Scintilla 5. * We now avoid any Scintilla message that automatically scrolls the caret (makes the caret visible) and instead call SCI_SCROLLCARET only once after every keypress in the interface implementation. * From nowon, use * SCI_SETEMPTYSELECTION instead of SCI_GOTOPOS * SCI_SETEMPTYSELECTION(SCI_POSITIONFROMLINE(...)) instead of SCI_GOTOLINE * SCI_SETSELECTIONSTART and SCI_SETSELECTIONEND instead of SCI_SETSEL * With these optimizations we are significantly faster than before the Scintilla upgrade (6e67f5a682ff46d69888fec61b94bf45cec46721). It is now even safe to execute the Gtk test suite during CI.
Diffstat (limited to 'src/doc.c')
-rw-r--r--src/doc.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/doc.c b/src/doc.c
index 9485f13..832eb90 100644
--- a/src/doc.c
+++ b/src/doc.c
@@ -45,7 +45,8 @@ teco_doc_edit(teco_doc_t *ctx)
(sptr_t)teco_doc_get_scintilla(ctx));
teco_view_ssm(teco_qreg_view, SCI_SETFIRSTVISIBLELINE, ctx->first_line, 0);
teco_view_ssm(teco_qreg_view, SCI_SETXOFFSET, ctx->xoffset, 0);
- teco_view_ssm(teco_qreg_view, SCI_SETSEL, ctx->anchor, (sptr_t)ctx->dot);
+ teco_view_ssm(teco_qreg_view, SCI_SETSELECTIONSTART, ctx->anchor, 0);
+ teco_view_ssm(teco_qreg_view, SCI_SETSELECTIONEND, ctx->dot, 0);
/*
* NOTE: Thanks to a custom Scintilla patch, se representations
@@ -64,7 +65,8 @@ teco_doc_undo_edit(teco_doc_t *ctx)
*/
//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_SETSELECTIONEND, ctx->dot, 0);
+ undo__teco_view_ssm(teco_qreg_view, SCI_SETSELECTIONSTART, ctx->anchor, 0);
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,