Skip to content

Disable syntax and search highlighting for very large files, based on a user-configurable size limit - #752

Open
KAMI911 wants to merge 2 commits into
linuxmint:masterfrom
KAMI911:perf/large-file-highlighting-limit
Open

Disable syntax and search highlighting for very large files, based on a user-configurable size limit#752
KAMI911 wants to merge 2 commits into
linuxmint:masterfrom
KAMI911:perf/large-file-highlighting-limit

Conversation

@KAMI911

@KAMI911 KAMI911 commented Aug 22, 2026

Copy link
Copy Markdown

xed had no size threshold for GtkSourceView syntax highlighting, so opening a large file made loading, scrolling, and searching noticeably slow, since the highlighting engine kept re-parsing the whole buffer on every change and every scroll. This change adds a size check when a document finishes loading: once the buffer exceeds a limit, syntax highlighting and the search "highlight all" mode are turned off automatically for that document, since they were the main cost for large files. The limit is user-configurable through Preferences > Editor > Highlighting via a new max-file-size-for-highlighting GSettings key, expressed in MB with a default of 4, where a value of 0 disables the limit entirely so highlighting is never turned off automatically. The debug log for XED_DEBUG_DOCUMENT now reports the exact character count of the file and the active limit whenever this kicks in, so the behavior is easy to verify.

Kálmán „KAMI” Szalai added 2 commits August 22, 2026 16:00
… a user-configurable size limit

xed had no size threshold for GtkSourceView syntax highlighting, so opening a large file made loading, scrolling, and searching noticeably slow, since the highlighting engine kept re-parsing the whole buffer on every change and every scroll. This change adds a size check when a document finishes loading: once the buffer exceeds a limit, syntax highlighting and the search "highlight all" mode are turned off automatically for that document, since they were the main cost for large files. The limit is user-configurable through Preferences > Editor > Highlighting via a new max-file-size-for-highlighting GSettings key, expressed in MB with a default of 4, where a value of 0 disables the limit entirely so highlighting is never turned off automatically. The debug log for XED_DEBUG_DOCUMENT now reports the exact character count of the file and the active limit whenever this kicks in, so the behavior is easy to verify.
The new highlighting-limit box and label reused the ids box6 and label2, which already existed elsewhere in the same GtkBuilder file. Duplicate ids in one interface file confuse GtkBuilder and left the whole preferences dialog blank when opened. Renamed the new widgets to box31 and label30, which are not used anywhere else in the file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant