diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2024-12-13 15:17:34 +0300 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2024-12-13 15:28:04 +0300 |
commit | 7871c54db8fe2b8dcd1cb81aaec3b85099cb20a8 (patch) | |
tree | e70e1f65b4adc2f17e678ebaa35e1d82775a43c9 /src/view.c | |
parent | e2313a7023410bccaa7bfec2f5966a6591d75bdc (diff) | |
download | sciteco-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/view.c')
-rw-r--r-- | src/view.c | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -645,7 +645,14 @@ teco_view_process_notify(teco_view_t *ctx, SCNotification *notify) g_printf("SCINTILLA NOTIFY: code=%d\n", notify->nmhdr.code); #endif - if (notify->nmhdr.code == SCN_STYLENEEDED) - /* Lexing in the container: only used for SciTECO */ + /* + * Lexing in the container: only used for SciTECO. + * + * The "identifier" is abused to enable/disable lexing. + * It could be extended later on for several internal lexers. + * The alternative would be an ILexer5 wrapper, written in C++. + */ + if (notify->nmhdr.code == SCN_STYLENEEDED && + teco_view_ssm(ctx, SCI_GETIDENTIFIER, 0, 0) != 0) teco_lexer_style(ctx, notify->position); } |