StackView: Allow scaling of StackView window#91
StackView: Allow scaling of StackView window#91its-izhar wants to merge 1 commit intodhananjaylatkar:mainfrom
Conversation
|
Hi @its-izhar Can you provide motivation behind this PR? I'm not sure changing window size is what people are looking for. |
|
The main motivation is to be able to let the stackview window take more area of the screen. There is no easy way to do that because the window size is fixed in the code. I personally use about 90-95% of the screen size in stackview to browse the new code repo when I don't have familiarity with the codebase to make most of the screen space. This commit does not change anything by default and only exposes the means so the window can be scaled by the user's preference. Let me know what you think. I had this commit in my fork for a bit, I thought others might benefit from it. |
|
can we have option to give size as "default" and "large"? internally "large" can use 95%. As I see it, people might be interested in making window larger (small window doesn't make any sense) and giving too much control to user is also confusing. |
ab261c6 to
235be79
Compare
Replace width_scale/height_scale options with a simpler "size" preset option. Users can now choose between "default" (85% width, 80% height) and "large" (95% of screen). Invalid size values fall back to "default" with a warning. Signed-off-by: Izhar Ameer Shaikh <izharits@gmail.com>
|
@dhananjaylatkar - Apologies for the late reply, I have been a bit occupied so couldn't get to this. I've updated the commit to address your concern. Now can you review latest commit? The new commit description now reads: |
dhananjaylatkar
left a comment
There was a problem hiding this comment.
Thanks for revisiting the PR.
I have some suggestions.
|
|
||
| if not M.cache.win_opened then | ||
| M.buf_open() | ||
| local preset = size_presets[M.opts.size] |
There was a problem hiding this comment.
access this inside buf_open instead of passing as argument
| -- width: fraction of screen width (0.85 = 85% of screen width) | ||
| -- height: fraction of screen height (0.8 = 80% of screen height) | ||
| -- Add more presets here as needed (e.g., "small", "medium") | ||
| local size_presets = { |
| -- height: fraction of screen height (0.8 = 80% of screen height) | ||
| -- Add more presets here as needed (e.g., "small", "medium") | ||
| local size_presets = { | ||
| default = { width = 0.85, height = 0.8 }, |
There was a problem hiding this comment.
make height=0.7 to match prev config
| -- height: fraction of screen height (0.8 = 80% of screen height) | ||
| -- Add more presets here as needed (e.g., "small", "medium") | ||
| local size_presets = { | ||
| default = { width = 0.85, height = 0.8 }, |
There was a problem hiding this comment.
should we rename default to medium?
we can keep "medium" in default opts
| title_pos = "center", | ||
| width = width, | ||
| height = height, | ||
| col = col - 1, |
There was a problem hiding this comment.
don't remove this. i like the gap :)
Implemented
width_scaleandheight_scaleoptions for stack view window.This replaces the previous fixed scaling factors with user-configurable options, and provides default values if the user does not specify them. Values are expressed as a fraction of the total screen size.
Values are always clamped to be between > 0 and <= 1 to prevent invalid sizes. If out of range values are provided, defaults are used.
The implementation ensures that the stack view window is always centered on the screen.
The most important benefit of this is that the user can easily choose how big or small they want the window to be, and it will always be centered on the screen.