1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 06:27:45 +00:00

Shell: Make SimpleVariable::hit_test_position not hit irrelevant offsets

Without this, any offset would be accepted as being part of the
SimpleVariable.
Fixes #11976 (by making it no longer crash).
This commit is contained in:
Ali Mohammad Pur 2022-01-21 17:06:56 +03:30 committed by Ali Mohammad Pur
parent 3c1ca61e74
commit 2e333b3571

View file

@ -2843,6 +2843,9 @@ void SimpleVariable::highlight_in_editor(Line::Editor& editor, Shell& shell, Hig
HitTestResult SimpleVariable::hit_test_position(size_t offset) const
{
if (!position().contains(offset))
return {};
if (m_slice && m_slice->position().contains(offset))
return m_slice->hit_test_position(offset);