mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 18:18:12 +00:00
LibGUI: Add TextDocument::take_line(size_t line_index)
This method is similar in all respects to remove_line except that it returns the removed line.
This commit is contained in:
parent
a85223e13b
commit
d391f1fb2a
2 changed files with 11 additions and 0 deletions
|
@ -270,6 +270,16 @@ void TextDocument::insert_line(size_t line_index, NonnullOwnPtr<TextDocumentLine
|
|||
}
|
||||
}
|
||||
|
||||
NonnullOwnPtr<TextDocumentLine> TextDocument::take_line(size_t line_index)
|
||||
{
|
||||
auto line = lines().take(line_index);
|
||||
if (m_client_notifications_enabled) {
|
||||
for (auto* client : m_clients)
|
||||
client->document_did_remove_line(line_index);
|
||||
}
|
||||
return line;
|
||||
}
|
||||
|
||||
void TextDocument::remove_line(size_t line_index)
|
||||
{
|
||||
lines().remove((int)line_index);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue