Add TEXT and LINE_COUNT flags to SCN_UPDATEUI

40 views
Skip to first unread message

Neil

unread,
Jul 13, 2026, 12:52:39 AMJul 13
to scintilla-interest
When investigating slow performance in applications that use Scintilla, excessive notifications are often the cause.

Applications often monitor SCN_MODIFIED to see if something has changed in Scintilla but, since these notifications may be fired intensely for some operations like replace all, they may cause a significant performance cost.

SCN_UPDATEUI fires on idle after modifications have occurred so can coalesce the effect of many SCN_MODIFIED events and thus perform better.

When implementing features like URL highlighting or spell checking, applications want to know when the text has changed. Currently, SCN_UPDATEUI reports SC_UPDATE_CONTENT for text changes but also for many other changes such as styling. If the feature is costly to perform then it shouldn't be run again for non-text changes. An SC_UPDATE_TEXT flag for SCN_UPDATEUI may improve this.

Applications may have a line number margin that widens or narrows depending on the number of digits needed to display all line numbers. A SC_UPDATE_LINE_COUNT flag for SCN_UPDATEUI can improve performance for this feature.

Both of these flags are trivial to calculate and no more notifications occur as they are just adding on to existing SC_UPDATE_CONTENT messages.

With these additions applications may be able to set the modification mask to receive fewer SCN_MODIFIED notifications or even none.

Are there any other events that are detected with SCN_MODIFIED that would be easy to summarize as SCN_UPDATEUI flags?

Neil

Neil Hodgson

unread,
Jul 18, 2026, 10:57:03 PMJul 18
to scintilla...@googlegroups.com
Added the start position of changes to SC_UPDATE_TEXT as this allowed
switching the spell checking implementation on macOS SciTE from
SCN_MODIFIED to SCN_UPDATEUI.

This could eliminate the need to watch for detailed content insertions
and deletions in SciTE's own code but these updates may still be
needed by Lua scripts. There might be a property to remove these
notifications in future.

It would be possible to also provide the range of changes but this
adds complexity and wasn't needed for the cases examined.

Potential patch attached.

Neil
UPDATE_TEXT.patch
Reply all
Reply to author
Forward
0 new messages