Skip to content

support for auto resize in x and y axis#43

Open
JoseConseco wants to merge 6 commits intoanuvyklack:mainfrom
JoseConseco:main
Open

support for auto resize in x and y axis#43
JoseConseco wants to merge 6 commits intoanuvyklack:mainfrom
JoseConseco:main

Conversation

@JoseConseco
Copy link
Copy Markdown

@JoseConseco JoseConseco commented Dec 28, 2024

Bunch of AI code, but seems to work. maybe config 'autoboth' should be exposed slightly different manner, but for ease of implementation if enabled it will auto resize windows in both x and y axis.
Default settings for autoboth:

require("windows").setup {
   autowidth = {
      enable = false,
      winwidth = 5,
      filetype = {
         help = 2,
      },
   },
   autoheight = {
      enable = false,
      winheight = 5,
      filetype = {
         help = 1,
      },
   },
   autoboth = { -- will use settings from autowidth sections (for width param) and autoheight section (for height controls)
      enable = true,
   },

end
recording_20241229_151847.mp4

@florianwar
Copy link
Copy Markdown

I am currently evaluating your PR in my setup and like it a lot.

I encountered a bug where windows.nvim/lua/windows/lib/api.lua:172: function 'set_height' gets called with non-integer values. I was able to workaround this quickly by just flooring it there but that is probably not the right way of tackling this.

Also i am a bit confused by the presence of the autoboth option, my assumption in terms of api would be that if autowidth and autoheight are enabled, autoboth would not be needed?!

@JoseConseco
Copy link
Copy Markdown
Author

I did not get any errors with set height, but it is based on 'original' set_width - where no round function is used. So I can only assume the value should be rounded before set_height is called... (btw. I get set_height on different line - so maybe you did not update the code?).
About auto-both, yes I should made it - use : width and/or height option , rather than both. But it was easier to code/generate as separate function. I did not want to change original code too much, so mostly new code was added with new modules/files. Original files were mostly kept as is - with only few height functions implemented (based on width counterparts) .

@d7omdev
Copy link
Copy Markdown

d7omdev commented Jan 6, 2025

So.. is this gonna get merged?

@JoseConseco
Copy link
Copy Markdown
Author

So.. is this gonna get merged?

The window dew was not active since war on ukraine started...

@d7omdev
Copy link
Copy Markdown

d7omdev commented Jan 6, 2025

I hope he's okay
Why don't you make a fork that we can use, at least until he's active again?

d7omdev added a commit to d7omdev/windows.nvim that referenced this pull request Jan 16, 2025
- Added `autoheight` and `autoboth` options to the configuration.
- Implemented `autoheight` and `autoboth` functions in
`calculate-layout.lua`.
- Updated `config.lua` to include new options.
- Modified `init.lua` to enable new options based on configuration.
- Updated `api.lua` and `frame.lua` to support autoheight and autoboth
resizing.

Code by: [JoseConseco](https://github.com/JoseConseco)
Implements: anuvyklack#43
d7omdev added a commit to d7omdev/windows.nvim that referenced this pull request Jan 16, 2025
- Added `autoheight` and `autoboth` options to the configuration.
- Implemented `autoheight` and `autoboth` functions in
`calculate-layout.lua`.
- Updated `config.lua` to include new options.
- Modified `init.lua` to enable new options based on configuration.
- Updated `api.lua` and `frame.lua` to support autoheight and autoboth
resizing.

Code by: @JoseConseco
Implements: anuvyklack#43
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.

3 participants