summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorthankyouverycool <66646555+thankyouverycool@users.noreply.github.com>2022-12-15 11:56:06 -0500
committerAndreas Kling <kling@serenityos.org>2022-12-20 10:22:27 +0100
commit360e58a276e4dd79e15430ff012054c690d9f0e5 (patch)
treec61fae879e81a83ea25c145d7dbc2abbabbbc992 /Userland
parent8d3f60c7efaf3d1ee7dda53fabf7c7f077486956 (diff)
downloadserenity-360e58a276e4dd79e15430ff012054c690d9f0e5.zip
LibGUI: Disallow GlyphMapWidget selection sizes equal to zero
This is a bogus size as the map must always have at least 1 glyph selected, and it was causing occasional desync between selection contents and the focused glyph when manipulating selections with the keyboard.
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibGUI/GlyphMapWidget.cpp2
-rw-r--r--Userland/Libraries/LibGUI/GlyphMapWidget.h1
2 files changed, 1 insertions, 2 deletions
diff --git a/Userland/Libraries/LibGUI/GlyphMapWidget.cpp b/Userland/Libraries/LibGUI/GlyphMapWidget.cpp
index 344e653bb7..be2ca8a094 100644
--- a/Userland/Libraries/LibGUI/GlyphMapWidget.cpp
+++ b/Userland/Libraries/LibGUI/GlyphMapWidget.cpp
@@ -44,7 +44,7 @@ bool GlyphMapWidget::Selection::contains(int i) const
void GlyphMapWidget::Selection::extend_to(int glyph)
{
m_size = glyph - m_start;
- if (m_size > 0)
+ if (m_size >= 0)
m_size++;
}
diff --git a/Userland/Libraries/LibGUI/GlyphMapWidget.h b/Userland/Libraries/LibGUI/GlyphMapWidget.h
index c184e76fd2..acc0c7a19a 100644
--- a/Userland/Libraries/LibGUI/GlyphMapWidget.h
+++ b/Userland/Libraries/LibGUI/GlyphMapWidget.h
@@ -58,7 +58,6 @@ public:
void set_active_range(Unicode::CodePointRange);
void set_active_glyph(int, ShouldResetSelection = ShouldResetSelection::Yes);
void set_selection(int start, int size, Optional<u32> active_glyph = {});
- void clear_selection() { m_selection.set_size(0); }
void scroll_to_glyph(int);
void update_glyph(int);