helix icon indicating copy to clipboard operation
helix copied to clipboard

Add layout-direction option for file picker

Open hunger opened this issue 1 year ago • 13 comments

Add a configuration option for Pickers to define the split-direction with the possible values of vertical (default) and horizontal.

This is how hx looks with the currently implemented vsplit between picker and preview in tall but narrow terminals: hx_vsplit

This is the new hsplit-based layout option: hx_hsplit

I find that this is way more helpful as paths get clipped less often and I can see more of the relevant lines in the preview.

Note: This is only implemented for the file picker at this time, but it would probably make sense to extend to all pickers with a preview.

hunger avatar Sep 09 '22 21:09 hunger

Ping? It's been a week and there was no feedback whatsoever.

hunger avatar Sep 16 '22 21:09 hunger

I think the sense of this is backwards compared to other verbiage in the editor. :vsplit results in a side-by-side split, whereas here "horizontal" is the side-by-side version. I got confused when i tried out this PR that "switching" it to horizontal had no effect at first.

EpocSquadron avatar Sep 17 '22 21:09 EpocSquadron

@EpocSquadron I am happy to switch this around if desired, but this is what every layout I ever ran into uses. And yes, I do find :vsplit behavior surprising:-)

hunger avatar Sep 17 '22 22:09 hunger

IMO this is almost ready for merge, but there's one remaining nitpick. As it stands, this PR changes the default picker layout direction from how it currently renders. I think we should keep the existing layout as default to avoid surprises.

EpocSquadron avatar Sep 18 '22 13:09 EpocSquadron

@EpocSquadron: Thanks for catching that! It would have been embarassing to merge it like that.

I forgot to switch the Default value when I went from "layout-direction" to "split-direction", swtching horizontal/vertical :-)

hunger avatar Sep 18 '22 19:09 hunger

@EpocSquadron I am happy to switch this around if desired, but this is what every layout I ever ran into uses. And yes, I do find :vsplit behavior surprising:-)

Yeah I found it a bit surprising too (split vertically vs vertical layout of horizontal panes?) but we follow nvim/kakoune for those.

Let's use

archseer avatar Sep 20 '22 07:09 archseer

@archseer: That's what confused @EpocSquadron :-)

His argument was that people in helix are used to :vsplit producing what you called a "Horizontal LinearLayout" -- with basically the splitter between the views being vertical. The current implementation tries to match that in both the naming (split-direction instead of layout-direction) and by calling your "Horizontal Linear Layout" vertical.

I am torn myself: On the one hand the direction seems wrong to me now -- based on how other people like CSS and UI toolkits name their layouts. On the other it does feel more consistent with the rest of helix.

hunger avatar Sep 20 '22 07:09 hunger

@archseer: A added a new patch on top which renames split-direction to layout-direction and also switches around the Horizontal and Vertical again (defaulting to Horizontal as it used to be).

I hope that addresses your comment.

hunger avatar Sep 22 '22 09:09 hunger

It's been another week since I did the requested changes.

Did I miss something or did you just have not had the time to look at this again?

hunger avatar Sep 29 '22 15:09 hunger

Yes, I've been away for a week. I'll review the changes soon.

archseer avatar Oct 03 '22 14:10 archseer

What is the status of this PR @hunger? Looks very interesting to me as I often have a relatively narrow editor.

jhthorsen avatar May 15 '23 00:05 jhthorsen

@jhthorsen: Feel free to take over. I have no idea how to fix the remaining issues and I was repeatedly told not to bother people with questions.

hunger avatar May 22 '23 08:05 hunger

Well.. I'm always available for questions.

archseer avatar May 22 '23 14:05 archseer

clsoing this one as stale, there is also a newer pr that implements this. Thank you for contributing!

pascalkuthe avatar Apr 13 '24 23:04 pascalkuthe