Cocoa change for styling and update UI

7 views
Skip to first unread message

Neil Hodgson

unread,
Jul 19, 2026, 9:20:56 PM (3 days ago) Jul 19
to scintilla-interest
When experimenting with the proposed SC_UPDATE_TEXT flag of SCN_UPDATEUI on MacOS Cocoa, I noticed that the stack trace for the SCN_UPDATEUI handler included Editor::Paint.

This meant that code that tried to improve performance by moving styling and notifications out of Editor::Paint was now failing.

The high-priority idle technique chosen by Win32 and GTK had been implemented for Cocoa with a run-loop observer but Scintilla's callback was being called after drawing. Changing the order parameter which determines priority from 0 to -1 changed this but -1 is the priority for input events so could cause poor performance by calling Scintilla continuously during rapid mouse/keyboard use instead of coalescing input events.

Before drawing, Cocoa calls the view's viewWillDraw method which was also able to perform styling and notifications. This wasn't working since the call to find the area being redrawn getRectsBeingDrawn was returning nothing. It is possible there have been platform updates that have changed this and there are online reports that this method is no longer dependable.

viewWillDraw was changed to use the whole content area if getRectsBeingDrawn returns nothing. This appears to fix the problem and should avoid drawing abandonment caused by styling.


https://sourceforge.net/p/scintilla/code/ci/8c82401bf8b57b422d660b72879ffe7e34e93556/


Neil

Reply all
Reply to author
Forward
0 new messages