Skip to content

Conversation

@Tillerino
Copy link

This Pull Request partly addresses #2748.

The "error" result from the binary search was not taken into account after an update to the status tree, which lead to files being skipped when the last file in a directory was staged.

Before:

Screencast_20251029_204232.webm

(skips zzz)

After:

Screencast_20251029_204327.webm

I followed the checklist:

  • I added unittests
  • I ran make check without errors
  • I tested the overall application
  • I added an appropriate item to the changelog

res.selection = Some(1);

res.update(&string_vec_to_status(&["d", "c", "a"])).unwrap();
res.update(&string_vec_to_status(&["a", "c", "d"])).unwrap();
Copy link
Author

@Tillerino Tillerino Oct 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to sort the list to keep this test working. The binary search assumes that the status list is sorted, but this is never validated in the status tree. I think this test used to pass accidentally, since the list is so short.

);

res.update(&string_vec_to_status(&["c", "d"])).unwrap();
assert_eq!(res.selected_item().unwrap().info.full_path, "c");
Copy link
Author

@Tillerino Tillerino Oct 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without the fix, the selection skips c and jumps straight to d.

@Tillerino Tillerino force-pushed the binary-search-error-result branch from 8409e2c to 01815be Compare October 29, 2025 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant