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

feat(side): Add Commands for Manual Width Resizing #333

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

niv-l
Copy link

@niv-l niv-l commented Apr 12, 2025

This PR addresses the inability to manually resize the dirvish-side window (#332) due to its window-size-fixed property. It introduces dedicated interactive commands that allow users to increase or decrease the side window's width on demand without permanently changing the dirvish-side-width setting or disrupting the fixed-size behavior during automatic window management.

niv-l added 4 commits April 12, 2025 13:03
The dirvish-side window is created with a fixed width (\`window-size-fixed\`),
which prevents users from adjusting its size manually using standard
window commands. This can be inconvenient when needing a temporarily
wider or narrower view.

This commit introduces two new interactive commands:
- \`dirvish-side-increase-width\`: Enlarges the side window.
- \`dirvish-side-decrease-width\`: Shrinks the side window.

These commands work by temporarily overriding the \`window-size-fixed\`
property during the resize operation using \`let ((window-size-fixed nil))\`.

A new custom variable, \`dirvish-side-width-increment\` (default: 5),
controls the amount by which the width is changed with each command.

The commands and the variable are marked with \`;;;###autoload\`.
Error handling for shrinking below minimum width is included.
@alexluigit
Copy link
Owner

alexluigit commented Apr 13, 2025

Thanks for the PR!

How about using the prefix argument to specify the increment value, similar to how dired-next-line and dired-previous-line handle the line count? dirvish-side-width-increment could then serve as the fallback value when no prefix argument is provided. This would also avoid the duplicated code in dirvish-side-decrease-width.

EDIT: Besides, it seems that these 2 commands should not be autoload as they are not useful before dirvish-side get called.

niv-l added 2 commits April 13, 2025 10:07
The `dirvish-side-increase-width` and `dirvish-side-decrease-width`
commands now accept a numeric prefix argument to control the resize
amount. If no prefix argument is given, the value of
`dirvish-side-width-increment` is used.
@niv-l
Copy link
Author

niv-l commented Apr 13, 2025

Hi, thanks for the feedback. I think that is a smarter way to go about it. I have committed these changes. :)

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