ladybird/Userland/Libraries/LibSyntax
Matteo Benetti 3e1626acdc Spreadsheet+LibSyntax: Never insert spans directly
Function `CellSyntaxHighlighter::rehighlight()` direct inserted spans
to TextDocument `m_span` vector missing out important reordering and
merging operation carried out by `TextDocument::set_spans()`.

This caused overlapping spans for a cell with only a `=` symbol
(one for the actual token and one for the highlighting) to
miscalculate `start` and `end` value and a `length` value (of
`size_t` type) with a `0-1` substraction (result: 18446744073709551615)
causing `Utf32View::substring_view()` to fail the
`!Checked<size_t>::addition_would_overflow(offset, length)` assertion

This remove the possibility to directly alter `TextDocument`'s spans
thus forcing the utilization of `HighlighterClient::do_set_spans()`
interface function.

Proper refactor have been applied to
`CellSyntaxHighlighter::rehighlight()` function
2023-04-14 10:00:52 +02:00
..
CMakeLists.txt LibSyntax: Move Language enum into its own files 2023-03-11 13:22:57 +00:00
Forward.h
Highlighter.cpp LibSyntax: Move Language enum into its own files 2023-03-11 13:22:57 +00:00
Highlighter.h Spreadsheet+LibSyntax: Never insert spans directly 2023-04-14 10:00:52 +02:00
HighlighterClient.h Spreadsheet+LibSyntax: Never insert spans directly 2023-04-14 10:00:52 +02:00
Language.cpp LibSyntax: Add Language-from-String/Path functions 2023-03-11 13:22:57 +00:00
Language.h LibSyntax: Add Language-from-String/Path functions 2023-03-11 13:22:57 +00:00