mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 08:36:15 +00:00
TreeView: Don't try to move cursor with invalid index
When clicking on the TreeView in profiler without selecting a node and then pressing up or pgup, cursor_index was in an invalid state. Instead select the first node in the index.
This commit is contained in:
committed by
Andreas Kling
parent
f295ac3c0b
commit
94551149d1
@@ -480,6 +480,9 @@ void TreeView::move_cursor(CursorMovement movement, SelectionUpdate selection_up
|
||||
{
|
||||
auto& model = *this->model();
|
||||
|
||||
if (!cursor_index().is_valid())
|
||||
set_cursor(model.index(0, model.tree_column(), cursor_index()), SelectionUpdate::Set);
|
||||
|
||||
auto find_last_index_in_tree = [&](const ModelIndex tree_index) -> ModelIndex {
|
||||
auto last_index = tree_index;
|
||||
size_t row_count = model.row_count(last_index);
|
||||
|
||||
Reference in New Issue
Block a user