One place to pick a buffer's highlighter
Filetype detection (extension or shebang) was written out three times (two open paths in Editor and the ImGui frontend's per-frame check) and "highlighter for this filetype, else the null one" five times (Buffer's copy constructor and assignment, Editor::SwitchTo, :set filetype). Buffer::ApplyDetectedFiletype and InstallFiletypeHighlighter replace them. The InvalidateFrom(0) calls after SetHighlighter are dropped: SetHighlighter already clears the caches. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015rcVQiiWyTzoNrsvLSaAfB
This commit is contained in:
@@ -472,6 +472,15 @@ public:
|
||||
}
|
||||
|
||||
|
||||
// Enable syntax with the highlighter the filename (or a shebang on the
|
||||
// first line) calls for, or none for an unknown type.
|
||||
void ApplyDetectedFiletype();
|
||||
|
||||
// Install the highlighter for Filetype() (the null highlighter for an
|
||||
// empty or unsupported one), creating the engine if needed.
|
||||
void InstallFiletypeHighlighter();
|
||||
|
||||
|
||||
// Swap journal integration (set by Editor)
|
||||
void SetSwapRecorder(kte::SwapRecorder *rec)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user