mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-26 19:29:16 +00:00
HackStudio: Start adding a "find in files" function
Projects now contain a set of TextDocument objects. Each TextDocument represents a member file in the project. TextDocuments may not have their file contents loaded at all times, but they will be loaded on demand when calling TextDocument::contents(). "Find in files" works by iterating over the documents in the project and calling find(needle) on each one. The return value from find() is a vector of line numbers where the needle was found. This is obviously going to need a bunch more work. :^)
This commit is contained in:
@@ -14,11 +14,11 @@ public:
|
||||
{
|
||||
int row = index.row();
|
||||
if (role == Role::Display) {
|
||||
return m_project.m_files.at(row);
|
||||
return m_project.m_files.at(row).name();
|
||||
}
|
||||
if (role == Role::Font) {
|
||||
extern String g_currently_open_file;
|
||||
if (m_project.m_files.at(row) == g_currently_open_file)
|
||||
if (m_project.m_files.at(row).name() == g_currently_open_file)
|
||||
return Font::default_bold_font();
|
||||
return {};
|
||||
}
|
||||
@@ -30,9 +30,11 @@ private:
|
||||
Project& m_project;
|
||||
};
|
||||
|
||||
Project::Project(Vector<String>&& files)
|
||||
: m_files(move(files))
|
||||
Project::Project(Vector<String>&& filenames)
|
||||
{
|
||||
for (auto& filename : filenames) {
|
||||
m_files.append(TextDocument::construct_with_name(filename));
|
||||
}
|
||||
m_model = adopt(*new ProjectModel(*this));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user