From 7c592561af3bbbad2eaf865247811ba2bd590c2e Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Thu, 29 Aug 2024 01:56:50 +0200 Subject: Glyph to byte offset mapping is now using the line character index (refs #5) * This works reasonably well unless lines are exceedingly long (as on a line we always count characters). The following test case is still slow (on Unicode buffers): 10000<@I/XX/> <%a-1:J;> While the following is now also fast: 10000<@I/X^J/> <%a-1:J;> * Commands with relative character offsets (C, R, A, D) have a special optimization where they always count characters beginning at dot, as long as the argument is now exceedingly large. This means they are fast even on exceedingly long lines. * The remaining commands (search, EC/EG, Xq) now accept glyph indexes. --- src/view.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/view.c') diff --git a/src/view.c b/src/view.c index fffe88c..6fecdc0 100644 --- a/src/view.c +++ b/src/view.c @@ -111,6 +111,12 @@ teco_view_setup(teco_view_t *ctx) teco_view_ssm(ctx, SCI_STYLESETFORE, STYLE_CALLTIP, 0x000000); teco_view_ssm(ctx, SCI_STYLESETBACK, STYLE_CALLTIP, 0xFFFFFF); + /* + * Documents are UTF-8 by default and all UTF-8 documents + * are expected to have a character index. + */ + teco_view_ssm(ctx, SCI_ALLOCATELINECHARACTERINDEX, SC_LINECHARACTERINDEX_UTF32, 0); + /* * Since we have patched out Scintilla's original SetRepresentations(), * it no longer resets them on SCI_SETDOCPOINTER. -- cgit v1.2.3