-
Notifications
You must be signed in to change notification settings - Fork 6
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
API enhancements #117
API enhancements #117
Conversation
efaa4a6
to
01a9d08
Compare
The scrolling is getting more complicated than I thought🥲 @tuurep can you help me with something?
|
Oh no :D Noted, will be getting back to this another day. |
fed6722
to
b1d715f
Compare
I don't need your answers to all those questions anymore, thanks anyways! I found a solution, I think this is ready for testing & review now :) You can open a file at a scroll position with I guess I should still add |
b1d715f
to
f64b103
Compare
So is the meaning of If I understand that correctly, then it seems to work
This however doesn't quite work, it does the scroll seemingly correctly on the existing tab, but then also opens a new tab with scroll at the top |
Actually it seems to only work inconsistently in the first place When I keep closing tab and doing |
It's the same thing that the POST request from Vim does: It scrolls the minimal possible amount so that the content corresponding to line
Shit ^^ what happens when you
Seems like you were very fast there! Up until now the clients only got cleaned up after not replying to a |
Ah, and adding to the |
Yeah it opens a new tab with So must be a firefox specific thing As far as I can see with a quick search, it looks like there's no flag for that Maybe achievable with some scripting but hard to say |
Hm, that's sad. I feel like it would be quite a significant UX-flaw not to reuse already open tabs. On macOS and Safari it works. This also puts us into a dilemma of how to implement this because we can only either have the reusing work for systems where you can open already open tabs, or open a new one at the given scrolling position. Or of course we can also support both with an option, but then it'll be a super-hard-to-explain option that is easy to set incorrectly or not set at all. One other approach I see is to not use |
Just for context, I found this
Other than that it would probably be possible with some scripting. I don't know how deep we want to get into this, especially since every combination of system/browser/window-manager might need its own script. What do you think about this @tuurep and what browser and window manager do you use? |
The firefox thing looks like it's not related to the URL being the same -case and I don't think it's usable for our case Chrome extension looks very relevant however Yeah it seems really difficult, even more so with the X/Wayland divide I'm using Openbox (under X) window manager and Firefox |
Just saw this as well: https://github.com/balta2ar/brotab. That might actually cover a majority of use cases. Anyways, if anything I would revert Vivify to give the option to specify an Edit we could also make it implicitly fall through some options, e.g. first try with |
Huh, might be the coolest thing I've seen in a while Well, I'm not used to tab reuse in any other context than this but it interests me By far I'm most interested in the scrolling to the correct location on invoking |
Since Vivify I assume :p
Yes, 100% related. The way we would do it from Vim is by running |
From giving And then based on whether it uses (1) This feature exploded completely haha, it seemed so easy and now it got so complicated |
Vivify is TheBest
Yeah but does this mean that all cursor-page syncing is migrated to doing Because for that case it's enough for me that |
No. The POST request is for scrolling whatever is already open,
Okay! If you think this is not that necessary then we can just not have it and the only problem we have is having to guess if our |
Although yeah there was this issue: When I open same file twice with When my expectation would be: don't (re)scroll the existing one, only open the new tab and then scroll on that |
Yes, exactly, this is the issue with your browser not reusing the tab. If it would, then it would not open the second tab and instead focus the first one, which also scrolled. That's how it's intended |
I think I actually just figured out a different solution: Instead of opening the URL to the requested file from the second EDIT this might be very hard to read haha, especially if you haven't seen the code yet🙈 But no worries, it's mostly for me to try it out next. |
Alright! I'll be back on this one, but I wanna go and do jannis-baum/vivify.vim#5 right now |
1382744
to
0e7fae1
Compare
Hey, yep this works and overall fantastic The only thing I can notice but I'm not sure of the expected behavior: If you bulk-open the same file many times with different lines to scroll i.e.
only one scroll, other opens at the top. What do you think about that? When files are different, both scroll. Also tested with 3 different and works. The tests are very comfortable and I got them to run and pass first try by only glancing at what you documented about them. Not sure what tests to add but noted for the future. |
Yes, this is directly caused by what I wrote in the footnote here and in the comment Lines 18 to 21 in 6237788
We could "fix" this by adding something like a mutex or semaphore around the section I described in the comment but I am not sure how much sense this makes since live updates from an editor for example will always affect all clients (tabs) the same way, i.e. all will end up at the exact same state. I have never done low level synchronization like this in Node/JavaScript so I'm not sure how much complexity it would introduce but I can definitely look into it. What do you think? |
Hmmm.. Do I read into it correctly that it could be a bit of a nightmare for a small detail? 😄 The use case of opening the same file at 2 places is sensible, but maybe not quite important. In fact could be one of our edgiest edge cases. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can approve this at this point but if there's something to consider we don't have to merge yet
Maybe haha. I can also just set myself a 10 minute timer and see how far I get and then decide :D Maybe I'll do that, we have to see how thread-safe objects in JS are and how/if Express/NodeJS even implements multithreading. If it's all just one thread it will be very easy. |
Ok sounds good! |
0feb7c4
to
cadabf9
Compare
cadabf9
to
808cd17
Compare
bbce70f
to
25a8ba3
Compare
6ac8070
to
a21cc05
Compare
So… I have said this before but I think/hope this should finally be all done now ^^ The message queuing is a lot more robust this way I think, I just can't really test opening the same file multiple times at different scroll locations because of course Safari reuses the same tab for all requests ^^ So let me know if this works now :) PS: If you want to look at what I changed to make this (hopefully) work now, you can just look at |
Great! Yes it works, for example
all as expected.
Thanks, I looked at it but hopefully won't have to go deep into it 😄 But sounds like good changes generally as well. So, do you think it can be merged? |
Great, thanks! Yes, let's finally merge this |
Closes #103