aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/symbols.c
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2024-12-13 15:17:34 +0300
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2024-12-13 15:28:04 +0300
commit7871c54db8fe2b8dcd1cb81aaec3b85099cb20a8 (patch)
treee70e1f65b4adc2f17e678ebaa35e1d82775a43c9 /src/symbols.c
parente2313a7023410bccaa7bfec2f5966a6591d75bdc (diff)
downloadsciteco-7871c54db8fe2b8dcd1cb81aaec3b85099cb20a8.tar.gz
fixup 244a54a18b7db6af177c9d10f3224772f08d7484: abuse the Scintilla view's "identifier" to enable lexing in the container
* SCI_SETILEXER(NULL) is not a reliable way to do that since that's the default for all views. * This was breaking the git.tes lexer for instance and was unnecessarily driving teco_lexer_style() on plain-text documents. * Since we currently do not implement the ILexer5 C++ interface and teco_view_t is just a pointer alias, we are abusing the view's "identifier" instead. This is probably sufficient, as long as there is only one lexer "in the container". Otherwise, there should perhaps be a single C++ class that does nothing but wrapping a callback into an ILexer5 object with a C ABI.
Diffstat (limited to 'src/symbols.c')
-rw-r--r--src/symbols.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/symbols.c b/src/symbols.c
index 798b89c..944d01d 100644
--- a/src/symbols.c
+++ b/src/symbols.c
@@ -321,13 +321,8 @@ teco_state_scintilla_lparam_done(teco_machine_main_t *ctx, const teco_string_t *
sptr_t lParam = 0;
- if (ctx->scintilla.iMessage == SCI_SETILEXER &&
- !teco_string_cmp(str, "sciteco", 7)) {
- /* perform lexing in the container (see teco_lexer_style()) */
- lParam = 0;
- }
#ifdef HAVE_LEXILLA
- else if (ctx->scintilla.iMessage == SCI_SETILEXER) {
+ if (ctx->scintilla.iMessage == SCI_SETILEXER) {
if (teco_string_contains(str, '\0')) {
g_set_error_literal(error, TECO_ERROR, TECO_ERROR_FAILED,
"Lexer name must not contain null-byte.");
@@ -341,9 +336,9 @@ teco_state_scintilla_lparam_done(teco_machine_main_t *ctx, const teco_string_t *
"Lexilla lexer \"%s\" not found.", lexer);
return NULL;
}
- }
+ } else
#endif
- else if (str->len > 0) {
+ if (str->len > 0) {
/*
* NOTE: There may even be messages that read strings
* with embedded nulls.