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
commit 2e333b3571
Notes: sideshowbarker 2024-07-17 20:31:28 +09:00

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);