1
Fork 0
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:
Andreas Kling 2020-10-29 23:52:07 +01:00
parent 4e0ab1dd22
commit 23c4f10027
2 changed files with 11 additions and 0 deletions

View file

@ -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;
}
}