ladybird/DevTools/HackStudio/ProjectFile.h
Andreas Kling 390b219cd1 HackStudio: Use GTextDoument::find_all() to implement find-in-files
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. :^)
2019-11-01 21:31:06 +01:00

28 lines
607 B
C++

#pragma once
#include <AK/ByteBuffer.h>
#include <AK/NonnullRefPtr.h>
#include <AK/RefCounted.h>
#include <AK/String.h>
#include <LibGUI/GTextDocument.h>
class ProjectFile : public RefCounted<ProjectFile> {
public:
static NonnullRefPtr<ProjectFile> construct_with_name(const String& name)
{
return adopt(*new ProjectFile(name));
}
const String& name() const { return m_name; }
const GTextDocument& document() const;
private:
explicit ProjectFile(const String& name)
: m_name(name)
{
}
String m_name;
mutable RefPtr<GTextDocument> m_document;
};