-
Notifications
You must be signed in to change notification settings - Fork 475
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(feat): Adding new quick-select dialog #2552
(feat): Adding new quick-select dialog #2552
Conversation
This adds a new quick-select dialog much akin to the Command Palette, except instead of selecting commands, it fuzzy finds on node name/path. This somewhat improves the UX, in my opinion, for quickly switching nodes. There is the `Ctrl+T` shortcut for "Find in Multiple Nodes...", but that search box does not have suggestions or live filtering. The inspiration for this feature comes from the `Ctrl+P` default binding in VS Code where you can search for a file very quickly and switch to it. I have put a default binding of `Ctrl+Alt+P` in, but that is a very rough "what I could find that wasn't already used" kind of map and I am very open to changing it. Also note, if there is some reason this feature hasn't been in CherryTree I am happy to abandon the PR. I just think it might make a really cool addition.
src/ct/ct_dialogs_sel_node.cc
Outdated
{ | ||
auto ctit = treeStore.to_ct_tree_iter(iter); | ||
auto full_path = CtMiscUtil::get_node_hierarchical_name(ctit, " / ", false); | ||
spdlog::debug("Node path for {} in ints is: {}", ctit.get_node_name(), path.to_string()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left in my debug on accident
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for sharing your work, please see my review comments
src/ct/ct_actions_file.cc
Outdated
void CtActions::command_selnode() | ||
{ | ||
auto id = CtDialogs::dialog_selnode(_pCtMainWin); | ||
auto node_iter = _pCtMainWin->get_tree_store().get_node_from_node_id(id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as you can return an invalid id (-1) for example if the user presses cancel on the dialog, you have to check that the returned node_iter is valid if (node_iter )
or set_cursor_safe() with a bad input will crash
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
D'oh... Completely slipped my mind on that one. Even added the -1 for this very purpose
src/ct/ct_dialogs_sel_node.cc
Outdated
@@ -0,0 +1,241 @@ | |||
/* | |||
* ct_dialogs_cmd_palette.cc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
file name to fix after copy/paste
Thank you for the prompt review! Really loving this software, there's something about it that is finally making it not just easy but fun to finally start organizing my life. Much appreciated. |
very nice work @ericguin thanks again for sharing it, I will look for a suitable default keyboard shortcut |
This is amazing. A few notes/feedback:
Thanks again for the awesome feature! |
This adds a new quick-select dialog much akin to the Command Palette, except instead of selecting commands, it fuzzy finds on node name/path.
This somewhat improves the UX, in my opinion, for quickly switching nodes. There is the
Ctrl+T
shortcut for "Find in Multiple Nodes...", but that search box does not have suggestions or live filtering.The inspiration for this feature comes from the
Ctrl+P
default binding in VS Code where you can search for a file very quickly and switch to it. I have put a default binding ofCtrl+Alt+P
in, but that is a very rough "what I could find that wasn't already used" kind of map and I am very open to changing it.Also note, if there is some reason this feature hasn't been in CherryTree I am happy to abandon the PR. I just think it might make a really cool addition.