1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-23 10:37:41 +00:00

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.
This commit is contained in:
thankyouverycool 2022-12-15 11:56:06 -05:00 committed by Andreas Kling
parent 8d3f60c7ef
commit 360e58a276
2 changed files with 1 additions and 2 deletions

View file

@ -44,7 +44,7 @@ bool GlyphMapWidget::Selection::contains(int i) const
void GlyphMapWidget::Selection::extend_to(int glyph) void GlyphMapWidget::Selection::extend_to(int glyph)
{ {
m_size = glyph - m_start; m_size = glyph - m_start;
if (m_size > 0) if (m_size >= 0)
m_size++; m_size++;
} }

View file

@ -58,7 +58,6 @@ public:
void set_active_range(Unicode::CodePointRange); void set_active_range(Unicode::CodePointRange);
void set_active_glyph(int, ShouldResetSelection = ShouldResetSelection::Yes); void set_active_glyph(int, ShouldResetSelection = ShouldResetSelection::Yes);
void set_selection(int start, int size, Optional<u32> active_glyph = {}); 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 scroll_to_glyph(int);
void update_glyph(int); void update_glyph(int);