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

Shift-J issue #12

Open
knubie opened this issue Mar 27, 2022 · 2 comments
Open

Shift-J issue #12

knubie opened this issue Mar 27, 2022 · 2 comments

Comments

@knubie
Copy link

knubie commented Mar 27, 2022

The behavior for shit-j is a little unexpected, I think. In the example video, instead of moving the entire map, only the first line of the map is moved and then the parinfer algorithm re-balances everything.

parinfer_shift-j.mp4
@gpanders
Copy link
Owner

gpanders commented Jun 6, 2022

Thanks for the issue report -- sorry I've let it sit idle for so long.

parinfer bugs are low on my priority list for now, mostly because 1) it works "well enough" for me and 2) debugging issues with text synchronization is a lot of work and not very fun 😆. The best/most reliable way to see this fixed would be to send a patch yourself, otherwise I will try and look at it whenever I have a moment of inspiration.

@dundalek
Copy link

dundalek commented May 4, 2023

I also stumbled on this. One can notice that with shift-j the cursor moves to the end of the original line onto a space character. So I tried to add an extra space to the end of the line to see what would happen if the cursor did not end up moving. It worked at first, but then it did not work at other times.

Here are the observations:

  1. base case - no
  2. after adding trailing whitespace - works
  3. trailing whitespace, then normal movement - no
    (it works the first time, I think it is due to the insert mode change from 2 to 3)
  4. trailing whitespace, making some edits in insert mode - works again
Peek.2023-05-04.12-45.mp4

I've narrowed it to observation that movement in normal mode sets some weird internal state. Changes in insert mode then fixes it.

It looks like Delete at the end of the line in insert mode behaves in similar way, it works after changes, but does not work after movement without changes.

Maybe we can narrow it down further one day, for now I added following mapping to my config as a workaround: nnoremap J A<space><esc>J.

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

3 participants