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

Horizontal split of half-screen mode #1962

Closed
mark2185 opened this issue May 23, 2022 · 11 comments
Closed

Horizontal split of half-screen mode #1962

mark2185 opened this issue May 23, 2022 · 11 comments
Labels
enhancement New feature or request

Comments

@mark2185
Copy link
Collaborator

Is your feature request related to a problem? Please describe.
Instead of having it split vertically where e.g. the commits take up half of the screen, and the code takes up the remaining half (and then everything gets wrapped), I'd rather it was one above the other.

Describe the solution you'd like
Up goes one half, down goes the other.

Describe alternatives you've considered
Couldn't find anything related to that in the configuration, I thought it might be affected by mainPanelSplitMode: 'vertical', but it's not (as expected).

@mark2185 mark2185 added the enhancement New feature or request label May 23, 2022
@c02y
Copy link

c02y commented May 24, 2022

+1 wrapping long lines is really annoying.

@51n7
Copy link

51n7 commented Oct 13, 2023

+1 and hoping for an update on this, thanks!

@hgustafsson
Copy link

I think it was very well described in #2364 how I would prefer to have the patch / commit details shown below the commit graph. Not only are the commit messages often clipped when having the current vertical split, but making it a horizontal split would also make it easier to view side-by-side diffs in the patch details.

@stefanhaller
Copy link
Collaborator

The change itself is easy, see here for a quick hack (it's interesting how this makes it look a lot more like gitk):
image

The challenge is how to make it configurable without introducing a mess of config settings that nobody understands. It seems that already today it's not clear what mainPanelSplitMode does. And there's also portraitMode, which, when set to "always", already gives you the desired layout in half-screen mode, but of course it also affects the normal mode too, which most people won't want.

Then there's the question of how to divide the space between upper and lower panel. For normal mode we have sidePanelWidth that allows you to configure the ratio, but for half-screen mode it's currently hard-coded to 1:1. I feel that even for the current vertical split it might be good to make this configurable, but even more for the new horizontal split mode; I feel 1:2 makes the most sense there (as in the screenshot above), so maybe we don't need a config for that if everybody agrees?

@stefanhaller
Copy link
Collaborator

Here's a PR if you want to test it: #3133

@hgustafsson
Copy link

This looks great! Thank you!

And thank you for explaining about portraitMode. I hadn't been able to make it work and thought I had misunderstood what it does, but now I realize that the setting was just implemented after the latest release 0.40.2 so I had to rebuild to make it work. Your PR allows for the option of a portrait mode only on half screen mode which is even better and exactly what I want.

I agree with the confusion of similar options. In #3133 you added the setting halfScreenSplitMode. What would you think about instead adding another option to portraitMode so that the options would be never, always, and now also half-mode (or something similar)?

@stk-ableton
Copy link

Glad to hear that this works for you. I'd also be interested in your opinion about hard-coding the 1:2 ratio for the vertical split mode.

I agree with the confusion of similar options. In #3133 you added the setting halfScreenSplitMode. What would you think about instead adding another option to portraitMode so that the options would be never, always, and now also half-mode (or something similar)?

I don't think this would work well, I see the two options as orthogonal. For example, when halfScreenSplitMode is set to "vertical", it should still be possible to decide between "never" and "auto" for portraitMode.

@hgustafsson
Copy link

I agree that a 1:2 ratio is much better than a 1:1 ratio for a vertical split. (Especially for the log panel)

Depending on what is done for the horizontal case in #3054 it may also make sense to make a separate setting for that.
Do you know if there has been any thoughts on making it resizable by keyboard shortcuts (e.g. similar to vim's Ctrl-W + and Ctrl-W - to resize splits)?

I don't think this would work well, I see the two options as orthogonal. For example, when halfScreenSplitMode is set to "vertical", it should still be possible to decide between "never" and "auto" for portraitMode.

You are right - hadn't thought about that.

@stefanhaller
Copy link
Collaborator

Do you know if there has been any thoughts on making it resizable by keyboard shortcuts (e.g. similar to vim's Ctrl-W + and Ctrl-W - to resize splits)?

I'm not aware of any such thoughts (that doesn't mean anything though, I joined the project pretty late). It would make sense, but the challenge is to find a free keybinding, as it has to be free in pretty much all views. Personally I'd love to be able to drag the frame between the views left or right (or up or down) with the mouse, like in gitk. I don't even think this would be terribly difficult to implement, but I haven't tried. We'd still want key bindings as well though, for those who turned off mouse support.

In both cases we'd have to decide how to persist the value; we'd probably store it in state.yml, and we can decide ourselves with what granularity we want to do that (at least separately for normal mode and half-screen mode, but in half-screen mode we might even store different settings depending on which side panel is active). The config.yml setting would have to be removed though, and we could consider migrating that value to state.yml for backwards compatibility.

Sounds fun, I'll play with this when I find some time.

@jesseduffield
Copy link
Owner

Yep, I've never really considered making windows adjustable, but I like the idea.

BTW @stefanhaller I'm testing this out locally and I like the 1:2 ratio. Happy for it to be hardcoded. I'll say more on the PR

@stefanhaller
Copy link
Collaborator

Implemented in #3133.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

7 participants