godbout / Scrolla.docs

Scroll with Vim motions under macOS
64 stars 0 forks source link

Single j press keeps scrolling while others behave as expected #12

Closed al3xandru closed 1 year ago

al3xandru commented 1 year ago

Title tries to explain it all: when pressing j the area continues to scroll down instead of that action occurring once. That's how k and other keys behave.

godbout commented 1 year ago

weird. the code is indeed the same for every scrolling move (just distance values change). some questions then:

  1. does it happen all the time
  2. what happens if you keep j pressed for a while and stops
  3. any chance you're having some other apps that are doing tricks with keys? like Karabiner-Elements, Hammerspoon, Keyboard Maestro etc.?
godbout commented 1 year ago

jfi, nobody else reported. and i haven't had this issue (after v1. had something similar during dev of course, because i built the shit properly).

al3xandru commented 1 year ago
  1. It happened consistently across apps.
  2. I will disable all the other apps and test again. I did not do this yet because 1) I don’t have any vim-like rules in any of them; 2) if they interfered, I expected to interfere with k too
godbout commented 1 year ago

alright, thanks, let me know. coz this is just plain weird πŸ˜…οΈ

godbout commented 1 year ago

if j keeps going down that means that somehow the j key up event is not being sent to Scrolla, if that is of any help.

al3xandru commented 1 year ago

I have disabled all other apps. And tried again with TextEdit. Same behavior. I'm trying to add a short screen recording, but I'm not sure what that would clarify.

godbout commented 1 year ago

would still be nice. really wanna see.

al3xandru commented 1 year ago

https://user-images.githubusercontent.com/290841/208241966-785ba1ee-441d-4ff9-ba52-f085044493d9.mov

al3xandru commented 1 year ago

Just seconds after posting... I noticed there is a lag in typing the j key. I then realized that the only app I have not stopped is "kindaVim" which is set to activate using... can you guess? jk πŸ˜†

al3xandru commented 1 year ago

I don't know what can be done or if there's anything to be done. From my pov the ticket can be closed.

godbout commented 1 year ago

gimme some time to think about it. i'll come back to you tomorrow.

godbout commented 1 year ago
  1. i can definitely reproduce
  2. pretty sure there's something that can be done within Scrolla and kV to make this work. might be that i send a keyup if the second character of the sequence is not pressed fast enough, or make Scrolla grabs keypresses before kV. not sure. need to digest and explore. but definitely will work out something.
godbout commented 1 year ago

ok, exploring. kV only cares about catching key presses, not key releases, so it's gonna be tricky. a question tho: how do you expect the thing to work? like if you use the jk sequence to enter Normal Mode with kV, the j press always has to be delayed, for the whole macOS, to wait for the next key press and check if it's your sequence. which means even if we get this to work, you'll have a delay with scrolling down with j in Scrolla: that'll be the delay set in your kV Settings, because kV will hold the key during during that delay period. would that be ok? (not even sure it's doable. may require make big changes to kV, which i'm not really keen to 😬️).

al3xandru commented 1 year ago

Honestly, I have no idea how this combination could be made different (or at least less unexpected). While using the jk chord to activate kindaVim sounds great on paper, it has a bit more impact on the system. Using it in a single app (vim) is slightly better from this perspective as it doesn't impact the whole system. IMO I'd put a note on kindaVim (or a link to the site) explaining 1) the impact; 2) potential unwanted interaction with Scrolla.

godbout commented 1 year ago

While using the jk chord to activate kindaVim sounds great on paper, it has a bit more impact on the system. Using it in a single app (vim) is slightly better from this perspective as it doesn't impact the whole system.

agreed. i don't use it myself and it wasn't in the first 20 prod versions i think. but it's been asked by several people. could be done through Hammerspoon but i've made an integrated version. it started as typing j directly, and removing it you typed k fast enough. but caused issue when using j and k not when typing letters but when using those letters to interact with UI Elements. so i went to the only possible delay route. i would tend to think that most people who are big users of jk know the tradeoffs.

IMO I'd put a note on kindaVim (or a link to the site) explaining 1) the impact; 2) potential unwanted interaction with Scrolla.

i'm also a big fan of avoiding complications and having texts and explanations everywhere πŸ˜…οΈπŸ˜‚οΈ the thing with Scrolla is that it never receives the keyup event for j, which is why it keeps scrolling. that definitely has to be worked out. but i think if there's a delay when using j because kV (or any other app like Hammerspoon for that matter) has a delay for jk, that should be quite understandable by the users. most of users of kV/Hammerspoon/Karabiner-Elements etc. know what they're getting into πŸ˜‚οΈ

godbout commented 1 year ago

@al3xandru i'm gonna release an update on kV that will mitigate the issue by sending a key up event when the j (or whatever first letter used) delay is passed. that will solved the problem that Scrolla never received the key up event. BUT you'll have a delay when scrolling using j with Scrolla. i think ultimately, with A LOT OF WORK AND CHANGES, i could reduce this delay. but not sure i wanna do it. that would require massive changes in kV's event system. not sure it's worth it. so i'll release this update soon, and you try and see what you think. we can then decide to dig deeper if needed from there.

al3xandru commented 1 year ago

@godbout the up event idea sounds quite smart! While I went back to using shortcuts for activation so this is not directly affecting my usage, I believe it's going to be useful long term.

godbout commented 1 year ago

πŸ‘οΈ

just out of curiosity, so now you don't use a sequence anymore at all? did you have to change your Vim habits? or your were just testing around?

godbout commented 1 year ago

improved with kV47: https://github.com/godbout/kindaVim.docs/releases/tag/47

al3xandru commented 1 year ago

@godbout activating kindaVim is not yet established so tweaking the activation shortcut is not painful. Or, differently put, having to deal with a delayed j key is more painful than changing that activation. Honestly, it's early days for kindaVim on my side. I don't know how many overlapping users are there between kindaVim and Scrolla and out of those how many are using the chord activation, but your improvement will make their experience better.

godbout commented 1 year ago

yeah. i'm not a big fan of the delay j, which is why i've never got into the jk thing. personally i use escape to enter Normal Mode, and i've remapped caps_lock to escape through the macOS Settings. definitely works very well for me.