mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 09:47:35 +00:00
HackStudio: Use GUI::TextDocument::span_at()
This commit is contained in:
parent
23c4f10027
commit
6365b44773
1 changed files with 13 additions and 15 deletions
|
@ -293,14 +293,13 @@ void Editor::mousedown_event(GUI::MouseEvent& event)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto& span : document().spans()) {
|
if (auto* span = document().span_at(text_position)) {
|
||||||
if (span.range.contains(text_position)) {
|
if (!highlighter->is_navigatable(span->data)) {
|
||||||
if (!highlighter->is_navigatable(span.data)) {
|
|
||||||
GUI::TextEditor::mousedown_event(event);
|
GUI::TextEditor::mousedown_event(event);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto adjusted_range = span.range;
|
auto adjusted_range = span->range;
|
||||||
adjusted_range.end().set_column(adjusted_range.end().column() + 1);
|
adjusted_range.end().set_column(adjusted_range.end().column() + 1);
|
||||||
auto span_text = document().text_in_range(adjusted_range);
|
auto span_text = document().text_in_range(adjusted_range);
|
||||||
auto header_path = span_text.substring(1, span_text.length() - 2);
|
auto header_path = span_text.substring(1, span_text.length() - 2);
|
||||||
|
@ -310,7 +309,6 @@ void Editor::mousedown_event(GUI::MouseEvent& event)
|
||||||
navigate_to_include_if_available(header_path);
|
navigate_to_include_if_available(header_path);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
GUI::TextEditor::mousedown_event(event);
|
GUI::TextEditor::mousedown_event(event);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue