summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibLine/Editor.cpp
diff options
context:
space:
mode:
authorsin-ack <sin-ack@users.noreply.github.com>2022-07-16 23:37:03 +0000
committerAli Mohammad Pur <Ali.mpfard@gmail.com>2022-07-17 00:51:31 +0000
commit57c8677b5c760c0d6039c5d2e22916404ef1a9a7 (patch)
tree47a11648348455810bc51813a68305c70f0af899 /Userland/Libraries/LibLine/Editor.cpp
parentac36d272d32812899204b0b91ee9c50411e459f2 (diff)
downloadserenity-57c8677b5c760c0d6039c5d2e22916404ef1a9a7.zip
LibLine: Ignore empty spans when stylizing
Previously we would erroneously apply the stylization to the whoever called stylize next. Now we first check whether the span is non-empty before stylizing. All non-empty spans must have at least one character in them (end-exclusive).
Diffstat (limited to 'Userland/Libraries/LibLine/Editor.cpp')
-rw-r--r--Userland/Libraries/LibLine/Editor.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/Userland/Libraries/LibLine/Editor.cpp b/Userland/Libraries/LibLine/Editor.cpp
index 0587cf13cc..c10c2497c3 100644
--- a/Userland/Libraries/LibLine/Editor.cpp
+++ b/Userland/Libraries/LibLine/Editor.cpp
@@ -463,6 +463,8 @@ Editor::CodepointRange Editor::byte_offset_range_to_code_point_offset_range(size
void Editor::stylize(Span const& span, Style const& style)
{
+ if (!span.is_empty())
+ return;
if (style.is_empty())
return;