-
Notifications
You must be signed in to change notification settings - Fork 9
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
Allow "left arrow" and "h" to collapse text sections #39
Conversation
@arxanas Please take a look :) I'd love to have this functionality in |
This probably needs another commit to hide the context between sections when they're collapsed, but it's still useful as is. Let me see if I can figure out how to hide the context. |
I didn't try this out yet; is it the same as arxanas/git-branchless#1051 (reply in thread)? |
Reading through that thread, yes, I think it is probably the same thing. Except perhaps that I think I would also like to hide the unchanged lines above a collapsed section (and below the last section, ideally). To be honest, I didn't even realize that I could press But even knowing that |
Actually, I think this PR can stand alone without hiding the context when a section is collapsed. Hiding the context may still be useful, but that could be a separate PR.
Edit2: The PR for hiding context around collapsed sections is #41 |
c575c44
to
748f391
Compare
I'm not opposed to collapsing the section by pressing left, but there needs to be some way to efficiently navigate by keyboard between files without collapsing the sections (that is, one that doesn't require an indefinite number of ups/downs/keypresses). This workflow might be common for users with large screens who want to see all of the sections at once while navigating between them. Some ideas:
|
FWIW, that's PgUp/PgDn in Mercurial's builtin editor. |
748f391
to
3ff37f6
Compare
Ok, I went ahead and opened #45 to change a few of the current key bindings and add new ones to jump between items of the same kind (i.e. jump between sections, files, or lines). This may not be sufficient to fully address the concerns raised in #39 (comment), but it should be easy enough to add additional keybindings if we'd like. |
Perhaps we'd also like to add a key binding to move outwards without collapsing the section. Maybe ctrl-left or shift-left? I'll take a more holistic look at the types of movement we might want and the potential keybindings. |
Sorry, meant to comment earlier: many of the current keybindings were lifted directly from Vim |
"Next of same kind" keybindings are good but they don't address the problem of getting back to the top-level without collapsing intermediate sections. I think my preference would be a keybinding that jumps to the containing file. ctrl-left sounds good to me for that for now; we should revisit all the keybindings again later. |
3ff37f6
to
a01bd93
Compare
94a6375
to
61d914b
Compare
@arxanas Sorry for the very long delay on fixing up this PR. I've pushed a new draft that adds ctrl-left and ctrl-h as keybindings to move outwards without collapsing a section. I also added ctrl-right and ctrl-l as alternative (and undocumented) bindings to move inwards for symmetry. I think those changes address your concerns in #39 (comment). The unqualified version of left and h will collapse the text section if it is expanded, otherwise it will move the focus outwards to the file. Please take a look and thanks for your patience. |
Hi @arxanas, just wanted to give this a friendly ping. Hope you'll have time to take a look in the next week or two. Many thanks :) |
61d914b
to
210afa1
Compare
@arxanas I noticed that you pushed the 0.4 release yesterday. Nice! Although I am a little bummed because it would have been nice to have this change included in a release that jj can use. Are you still open to merging this? I just synced the branch to main, so this should merge cleanly. Let me know if there's anything else I can do. Thanks! |
@emesterhazy sorry about that, I haven't had time to review due to being busy with work. I have had a little free time recently but am focused in fighting fires/getting out bugfix releases (for scm-record redrawing issues => git-branchless and jj as downstream consumers, plus git-branchless for Git 2.46+). Hopefully I'll get a chance to review soon. I prefer not to release meaningful changes without giving them some time to "bake" on the main branch and get feedback from bleeding-edge users (in particular me 😁, sometimes others). Oftentimes there are bugs or I want to redo/rethink something altogether. That being said, I haven't thought it through as much for this case, where we're publishing a library instead of a binary directly. That is, bleeding-edge jj and git-branchless users won't get the latest scm-record changes even if they're building the binaries from source.
|
That would work.
I think that would make jj's security policy bot unhappy. |
No worries regarding not having time to review. We're all doing this for fun and to make the tools we use every day even better. You've already made a huge contribution in creating scm-record. But, if you do have time to review soon, that would be amazing since I'd really like to use this with Google's internal build of jj (I've already compiled it into the version I use with git). Regarding the versioning, it sounds like Martin is on top of it, but if I'm understanding correctly, we'd still need to update the version listed in the Cargo.toml, right? That doesn't seem like a big deal if there's a 0.5 release to point to for example, I'm just not sure how building without |
@martinvonz Does it make a difference if we were to pin the dependency to a specific hash and update that frequently? It might be easier than actually publishing new releases frequently. (I guess it could be triggered by CI.)
@emesterhazy I was referring to https://doc.rust-lang.org/cargo/reference/resolver.html#semver-compatibility, in which I forgot about this bit, though:
It might be fine to regularly publish on the Possibly there's a better solution using some aspect of the version requirement syntax or prerelease versions. |
Yes, that would work. I almost suggested doing that but it would still be mean that we don't get the new versions imported at Google (we only import released versions). But that's a separate problem. OTOH, I don't think it sounds so bad to release versions that might have bugs, especially if you're saying that it would just impact anyone using scm-record as a library (as jj does). So if you release a new scm-record version soon, we'd have about 3 weeks to test it in jj before the next release (early november). |
These are currently duplicative of the unqualified versions of left and h. In the next commit however, we will make left and h collapse the current text section if it is expanded, or move outwards if it is already collapsed. Adding the ctrl keybindings will give users a way to jump out without collapsing the section. For consistency, ctrl-right and ctrl-l are also supported as keybindings to move the focus inwards.
210afa1
to
a8c0f61
Compare
I synced this with main and everything still works. Friendly ping hoping you'll get a chance to look at this soon. The changes are actually fairly minimal; a large portion of the diff is just a new test case. |
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 your patience and for implementing this! This is probably a quality of life improvement for many users overall, so we can ship it even if it has some theoretical concerns.
@emesterhazy Thanks for working on this! Sorry for the delay; I had been busy at work, and then a little burnt out afterwards, but I think I've more or less recovered. You can merge this when you think it's ready. I think it's just nits and idle long-term speculation on my end.
|
Thanks for the review and great feedback. Let me address your comments before we merge this. After that, a new release would be great so that it can be incorporated into jj. |
a8c0f61
to
ac3c44b
Compare
After this change the "left arrow" and "h" keypresses will collapse a text section if it is expanded and currently selected. This allows users to navigate around a diff more easily since they don't need to scroll through all of the lines in a section to get to the next section. Instead, they can just collapse the section quickly and move to the next one. This fixes one of my only gripes about scm-record compared to the builtin editor in Mercurial.
ac3c44b
to
092735c
Compare
I think GitHub lost one of my comments. I made the following changes:
I'll merge this and work on a PR to push a new release later. Thanks again! |
After this change the "left arrow" and "h" keypresses will collapse a text
section if it is expanded and currently selected.
This allows users to navigate around a diff more easily since they don't need
to scroll through all of the lines in a section to get to the next section.
Instead, they can just collapse the section quickly and move to the next one.
This fixes one of my only gripes about scm-record compared to the builtin
editor in Mercurial.