Skip to content

StackView: Allow scaling of StackView window#91

Open
its-izhar wants to merge 1 commit intodhananjaylatkar:mainfrom
its-izhar:stackview
Open

StackView: Allow scaling of StackView window#91
its-izhar wants to merge 1 commit intodhananjaylatkar:mainfrom
its-izhar:stackview

Conversation

@its-izhar
Copy link
Contributor

Implemented width_scale and height_scale options 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.

@dhananjaylatkar
Copy link
Owner

Hi @its-izhar

Can you provide motivation behind this PR? I'm not sure changing window size is what people are looking for.

@its-izhar
Copy link
Contributor Author

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.

@dhananjaylatkar
Copy link
Owner

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.

@its-izhar its-izhar force-pushed the stackview branch 2 times, most recently from ab261c6 to 235be79 Compare February 3, 2026 01:07
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>
@its-izhar
Copy link
Contributor Author

@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:

StackView: Add size presets for stack view window
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.

Copy link
Owner

@dhananjaylatkar dhananjaylatkar left a comment

Choose a reason for hiding this comment

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

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]
Copy link
Owner

Choose a reason for hiding this comment

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

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 = {
Copy link
Owner

Choose a reason for hiding this comment

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

move it below opts

-- 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 },
Copy link
Owner

Choose a reason for hiding this comment

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

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 },
Copy link
Owner

Choose a reason for hiding this comment

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

should we rename default to medium?

we can keep "medium" in default opts

title_pos = "center",
width = width,
height = height,
col = col - 1,
Copy link
Owner

Choose a reason for hiding this comment

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

don't remove this. i like the gap :)

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.

2 participants