mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 01:27:42 +00:00
LibGUI: Add TextDocument::span_at(TextPosition)
This commit is contained in:
parent
4e0ab1dd22
commit
23c4f10027
2 changed files with 11 additions and 0 deletions
|
@ -699,4 +699,13 @@ TextRange TextDocument::range_for_entire_line(size_t line_index) const
|
|||
return { { line_index, 0 }, { line_index, line(line_index).length() } };
|
||||
}
|
||||
|
||||
const TextDocumentSpan* TextDocument::span_at(const TextPosition& position) const
|
||||
{
|
||||
for (auto& span : m_spans) {
|
||||
if (span.range.contains(position))
|
||||
return &span;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue