mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-27 23:09:08 +00:00
LibGUI: Unbreak FileSystemModel::index(path) after virtual root changes
Now that the "/" directory can have a (virtual) parent index, we need to account for that when converting a full path to a model index.
This commit is contained in:
parent
56328409d9
commit
76ae47c6ed
Notes:
sideshowbarker
2024-07-19 02:21:01 +09:00
Author: https://github.com/awesomekling
Commit: 76ae47c6ed
1 changed files with 2 additions and 2 deletions
|
@ -187,9 +187,9 @@ String FileSystemModel::Node::full_path() const
|
|||
ModelIndex FileSystemModel::index(const StringView& path, int column) const
|
||||
{
|
||||
LexicalPath lexical_path(path);
|
||||
const Node* node = m_root;
|
||||
const Node* node = m_root->m_parent_of_root ? &m_root->children.first() : m_root;
|
||||
if (lexical_path.string() == "/")
|
||||
return m_root->index(column);
|
||||
return node->index(column);
|
||||
for (size_t i = 0; i < lexical_path.parts().size(); ++i) {
|
||||
auto& part = lexical_path.parts()[i];
|
||||
bool found = false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue