mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-25 14:05:15 +00:00
This fixes the bug seen in my monthly OS update video, where we'd look through a stale copy of each file, instead of the potentially edited version in the GTextDocument. Search results are now also represented as a full GTextRange, and when you jump to a search result, we select the whole matching range. :^)
16 lines
416 B
C++
16 lines
416 B
C++
#include "ProjectFile.h"
|
|
#include <LibCore/CFile.h>
|
|
#include <string.h>
|
|
|
|
const GTextDocument& ProjectFile::document() const
|
|
{
|
|
if (!m_document) {
|
|
m_document = GTextDocument::create(nullptr);
|
|
auto file = CFile::construct(m_name);
|
|
if (!file->open(CFile::ReadOnly)) {
|
|
ASSERT_NOT_REACHED();
|
|
}
|
|
m_document->set_text(file->read_all());
|
|
}
|
|
return *m_document;
|
|
}
|