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
Open
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.