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

VimResized should be added by default in the trigget_events for the register #5

Closed
pocco81 opened this issue Sep 27, 2021 · 5 comments

Comments

@pocco81
Copy link

pocco81 commented Sep 27, 2021

Hello :) First off, I really love this plugin! not only because of how useful it is, but also because it's all I ever needed to close this issue in a repo of mine.

Now, why should VimResized be added by default? Here is an example:

Without VimResized

without_resized.mp4

With VimResized

with_resized.mp4

Explanation

Basically what's going on here is that I have tmux open, with 3 splits, and the one in the left is being focused at the beginning and then unfocused. Without that event, after one moves the cursor (in my case), the text "shifts" (I have wrap set), however with VimResized it does not happens, for obvious reasons.

Notice that this isn't like a tmux-only thing, you can test this by simply using any other terminal multiplexer or by resizing the terminal.

Perhaps it'd be good it add it by default?

@kwkarlwang
Copy link
Owner

kwkarlwang commented Sep 27, 2021

Hi Pocco81, thank you for the kind words! Glad that the plugin has helped you out.

Now I am not too sure I have reproduced correctly. But I have three tmux windows opened, with wrap turned on, and I am toggling the tmux zoom on my left buffer and everything seems to work correctly, I was not able to reproduce the error.

My setup is as followed

			require("bufresize").setup({
				register = {
					keys = {
						{ "n", "<leader>w<", "30<C-w><", NS },
						{ "n", "<leader>w>", "30<C-w>>", NS },
						{ "n", "<leader>w+", "10<C-w>+", NS },
						{ "n", "<leader>w-", "10<C-w>-", NS },
						{ "n", "<leader>w_", "<C-w>_", NS },
						{ "n", "<leader>w=", "<C-w>=", NS },
						{ "n", "<leader>w|", "<C-w>|", NS },
						{ "n", "<leader>wo", "<C-w>|<C-w>_", NS },
						{ "", "<LeftRelease>", "<LeftRelease>", NS },
						{ "i", "<LeftRelease>", "<LeftRelease><C-o>", NS },
					},
				},
			})

I suspect there is actually a Vim error, can you check :messages after resizing and see if there are any errors?

Screen.Recording.2021-09-26.at.10.23.16.PM.mov

@kwkarlwang
Copy link
Owner

I don't know why adding VimResized to register help you solve the problem, because if you have VimResized in resize, then the resize actually call register to record the state after the applying the proportional resize to the windows.

@pocco81
Copy link
Author

pocco81 commented Sep 27, 2021

Huh that's weird. Can I see your bufresize conf? Mine is in the dev branch on my dots repo.

@kwkarlwang
Copy link
Owner

For sure, it is here.

I have tried the config on your dev branch with the same lazy loading event, commit version and setup, but still cannot reproduce the error.

Now I have encountered needing to press one more key for the wrapping to happen, but then later I found out that actually means there is an error occurred in the command window, it is just not shown when resized, you would have to manually check it through :messages. Not sure if this is the same case as yours.

@kwkarlwang
Copy link
Owner

I am going to close this for now. But feel free to open it again if you have more problems.

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

No branches or pull requests

2 participants