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

Cannot jump to the desired position if multiple windows contain the same content #142

Open
rockyzhang24 opened this issue Apr 7, 2022 · 4 comments
Labels
help wanted Extra attention is needed

Comments

@rockyzhang24
Copy link

For example, I totally opened three windows and the contents of each one are the same.

image

My cursor is located at line 126 in the leftmost window. I want to jump to itemIndex++, line 132, in the middle window. So I press gs followed by it

image

You can see that all these three windows have the same beacons. Then I press H. My cursor jumps to line 132 in the rightmost window, instead of the middle one.

image

Next for the further test, I move the contents in the rightmost window upward a little bit. Now I press gs followed by `it, and they still have the same beacons and I still cannot jump to the middle window.

image

Thank you so much.

@rockyzhang24
Copy link
Author

Hello @ggandor Any workaround for this? Thanks a lot.

@ggandor
Copy link
Owner

ggandor commented Apr 12, 2022

This is very tricky, because extmarks (i.e., labels) can only be set for a buffer, and not for a window. So if you open multiple windows with the same content, then you will jump kinda "randomly" to one of them (depends on the order in winlayout). That said, I don't see why this is such a huge problem - why would you want to open more than two windows with the exact same content in the first place, and jump back and forth between them?

@rockyzhang24
Copy link
Author

I see. Thanks for the explanation.

That said, I don't see why this is such a huge problem - why would you want to open more than two windows with the exact same content in the first place, and jump back and forth between them?

For example, sometimes we may open three windows with the same file, one window for editing, and the other two for reference. Look at my last screenshot above please. I use the left window for editing, the middle window and the right window to refer different sections. However, as long as the middle window and the right window have same lines even if they are in a different position, we cannot jump to the window we want.

Thank you.

@ggandor
Copy link
Owner

ggandor commented Apr 12, 2022

Yeah, I see. If there's even some overlap between two or more windows, it can prevent deterministic cross-window jumping. I don't see how this could be solved... I'll think about it though.

@ggandor ggandor added the help wanted Extra attention is needed label Apr 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants