Skip to content
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 alt + shift click to expand all ellipsis goals #871

Merged
merged 2 commits into from
Aug 20, 2024

Conversation

Durbatuluk1701
Copy link
Contributor

@Durbatuluk1701 Durbatuluk1701 commented Aug 20, 2024

Given the following case where you have a goal that is collapsed:
image

You can use alt + click to expand it to something like this:
image

However, I frequently find myself wanting to expand all the way if I am doing expanding, so I added a feature such that alt + shift + click will expand the original to this instead (note that no ellipsis remain as it will expand everything below the clicked on ellipsis):
image

Additionally, I found some typos while adding this feature and fixing them is included as well.

const {mode, depth, coqCss, id, indent, breaks, boxChildren, hovered, maxDepth, addedDepth} = props;
const [hide, setHide] = useState<boolean>(depth >= maxDepth);
const {mode, depth, coqCss, id, indent, breaks, boxChildren, parentHide, hovered, maxDepth, addedDepth} = props;
const [selfHide, setSelfHide] = useState<HideStates>(ComputeHideState(depth >= maxDepth ? HideStates.HIDE : HideStates.UNHIDE, parentHide));
const [depthOpen, setDepthOpen] = useState<number>(addedDepth);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

One thing I might add, I was a bit confused about the depthOpen variables usage, so maybe there is a simpler solution to the "expand all the way" problem using that variable?

Copy link
Collaborator

Choose a reason for hiding this comment

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

depthOpen controls at what depth an ellipsis will open. So when you click on an ellipsis, instead of only unfolding it's child, it will go down depthOpen which is more comfortable than having to unfold one by one.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Sorry to clarity, depthOpen tracks the current depth at which an ellipsis happens, so the depth until which eveything is open. The ADDED_DEPTH_FACTOR just allows us to increment this in steps larger than 1.

@TheoWinterhalter
Copy link

I wonder, should it not be a button "Unfold all"? This way it's more accessible to newcomers?

@rtetley
Copy link
Collaborator

rtetley commented Aug 20, 2024

We could add an unfold all button, but I believe it would be different. In this case it just unfolds one ellipsis all the way to the bottom. Unfold all would open everything right ?

@rtetley rtetley changed the title Adding alt + shift click to expand all ellipsis goals + fixing typos feat: adding alt + shift click to expand all ellipsis goals Aug 20, 2024
@rtetley
Copy link
Collaborator

rtetley commented Aug 20, 2024

Thanks for your contribution ! Just took the liberty of documenting the shortcuts. Concerning the Open all button we can move that to a separate issue !

@rtetley rtetley merged commit 65af50b into coq:main Aug 20, 2024
24 checks passed
@Durbatuluk1701 Durbatuluk1701 deleted the shift-ellipsis-expansion branch August 24, 2024 16:35
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.

3 participants