summaryrefslogtreecommitdiff
path: root/src/highlighter.hh
AgeCommit message (Collapse)Author
2025-07-08Replace std::unique_ptr with a custom implementationMaxime Coste
<memory> is a costly header we can avoid by just implementing UniquePtr ourselves, which is a pretty straightforward in modern C++, this saves around 10% of the compilation time here.
2025-06-25Introduce a Replace HighlightPass that runs before WrapMaxime Coste
For WrapHighlighter to be able to take ReplaceRangesHighlighter into account, it needs to run afterwards, moreover, moving TabulationHighlighter to the replace pass means we should be able to remove any tabulation specific handling from WrapHighlighter Also move ShowWhitespaceHighlighter to this pass as it is designed to replace TabulationHighlighter by running before (as builtin highlighters run after non builtin ones for each passes)
2025-06-25Rework highlighting management of cursor positionMaxime Coste
Move the whole responsibility of making the cursor visible to the window, removing cursor_pos from the display setup and resolving the cursor location by finding it in the display buffer afterwards. This simplifies hightlighters' do_compute_display_setup as they do not need to compute the cursor location. Highlighting may run on more lines than necessary after this change but this should be a minor performance hit.
2024-08-16include headers cleanupAdrià Arrufat
2024-08-12Move debug utils to debug.hh/debug.ccMaxime Coste
Lots of code includes buffer_utils.hh just for write_to_debug_buffer which pulls many unnecessary dependencies. Reorganise to reduce compile times.
2023-09-02Do not make cursor visible after mouse scrolling and view commandsMaxime Coste
ensure cursor is visible after user input except if the command implementation opted-out. Hooks and timers should not enforce visible cursor. PageUp/PageDown and `<c-f>` / `<c-b>` commands still move the cursor as this seemed a desired behaviour.
2023-08-23Revert "Only make cursor visible after buffer or selection change"Maxime Coste
This is currently broken on various corner cases and breaks the "master branch should be good for day to day work" implicit rule, ongoing work to stabilize this feature will take place on the no-cursor-move-on-scroll branch until its deemed ready. This reverts commit 1e38045d702ec6eb2425016d9b02636270ab1b1e. Closes #4963
2023-08-16Only make cursor visible after buffer or selection changeMaxime Coste
Kakoune now does not touch cursors when scrolling. It checks if either the buffer or selections has been modified since last redraw. Fixes #4124 Fixes #2844
2022-07-10Refactor highlighting logicMaxime Coste
Always start with full buffer lines and trim the display buffer at the very end, treat non-range display atoms as non-trimable in that case and keep track of how many columns are occupied by "widgets" such as line numbers or flags. Fixes #4659
2021-11-05src highlighters: Factorise docstringsFrank LENORMAND
Fixes #4367.
2021-10-07GrammarJonta
2020-03-30Add -override support to add-highlighterMaxime Coste
This allow replacing a highlighter in place, not loosing its current position in its parent. Fixes #3436
2019-01-24Header and dependency cleanupMaxime Coste
2018-07-05Prevent adding region/default-region highlighters to non-regions parentsMaxime Coste
2018-07-05Refactor add-highlighter to make naming explicitMaxime Coste
The highlighter name must be given as part of the path of the highlighter, as the last element. Fixes #1712
2018-06-11Pass DisplaySetup through the HighlightContextMaxime Coste
2018-04-07Make FaceRegistry scopedMaxime Coste
set-face now takes a scope argument, and faces can be overridden on a buffer or window basis. colorscheme apply on global scope, which should be good enough for now. Fixes #1411
2018-04-06Make compute_display_setup methods constMaxime Coste
2017-11-25Highlighters: Introduce unique highlighter supportMaxime Coste
Some highlighters, such as wrap or line numbers, are not intended to be used multiple times on the same display. Add support for unique ids that are used by highlighters to disable themselves if another unique highlighter with the same id is supposed to override them. The usual highlighter "precedence" takes, place, that it, that most nested highlighter will the the one to run (window in priority to buffer in priority to global).
2017-06-09Fix wrapping supportMaxime Coste
2017-05-11Disable horizontal scroll offset support when wrappingMaxime Coste
2017-05-08Move SimpleHighlighter as an implementation detailMaxime Coste
2017-05-07Slight highlighting related code cleanupMaxime Coste
2017-05-07Move passes logic to the base Highlighter classMaxime Coste
Validate that childs of HighlighterGroup are matching its passes.
2017-05-07Make scrolling around work more correctly with wrappingMaxime Coste
2017-05-07Introduce highlighting phases and display setup computationMaxime Coste
Highlighters now run in 3 phases: Wrap, Move, and Colorize. That way we guarantee the wrap highlighter runs first, then eventual line numbers/flags, and finally the colorizers. We also run a `compute_display_setup` method thats responsible for computing the lines that will be displayed, eventually scrolling the view to ensure the cursor is visible.
2017-03-07Replace IdMap with HashMapMaxime Coste
2017-01-08Apply clang-tidy modernize to the codebaseMaxime Coste
2016-11-28Add more memory domains to certain dataMaxime Coste
2015-06-01Remove redundant forward declarationMaxime Coste
2015-05-26Retreat ! go back to C++11 only codeMaxime Coste
This reverts commit b42de850314e7d76f873ddc7d64c5f7d2a30eb00.
2015-05-25Migrate code to c++14Maxime Coste
2015-04-23Use a struct for BufferRange rather than std::pairMaxime Coste
2015-03-09ArrayView content is not const anymoreMaxime Coste
As in upcoming std c++ array_view, ArrayView<T> points to mutable data, use ArrayView<const T> or alias ConstArrayView<T> for const data.
2015-02-19Add docstrings to highlighters, displayed by addhl helpMaxime Coste
2015-01-06Rename memoryview to ArrayViewMaxime Coste
2014-12-23Rename id_map to IdMapMaxime Coste
2014-12-23Use an id_map directly for HighlighterRegistry rather than the ↵Maxime Coste
FunctionRegistry class
2014-12-16Rework hashing, use a more extensible framework similar to n3876 proposalMaxime Coste
std::hash specialization is a pain to work with, stop using that, and just specialize a 'size_t hash_value(const T&)' free function.
2014-12-02Pass a BufferRange to highlighters, fix subregionsMaxime Coste
Regions highlighter can now correctly be applied to only subrange of the buffer, fixing some corner cases in recursive regions.
2014-10-25Add virtual destructor to HighlighterMaxime Coste
2014-10-22Refactor highlighters, use an interface with virtual methodsMaxime Coste
2014-06-10Replace FunctionGroup template with HighlighterGroup classMaxime Coste
2014-01-18Pass a HighlightFlags parameter to highlightersMaxime Coste
When only highlighting for finding character position on screen pass HighlightFlags::MoveOnly so that non moving highlighters do not need to run.
2014-01-09Style changes, replace typedefs with usingsMaxime Coste
2013-12-16Pass a Context rather than a Window to highlightersMaxime Coste
2013-12-03Add support for defining and referencing highlightersMaxime Coste
* defhl <name> defines a shared highlighter * addhl -def-group <name> adds highlighters to the defined highlighter * addhl ref <name> add the defined highlighter to the window's ones
2013-11-28Do not pass a window to highlighters factoriesMaxime Coste
2013-07-26memoryview: always pass by valueMaxime Coste
2013-05-29pass window param to highlightersMaxime Coste