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

J Join behaving strangely #46

Closed
djhmateer opened this issue Apr 13, 2020 · 6 comments
Closed

J Join behaving strangely #46

djhmateer opened this issue Apr 13, 2020 · 6 comments

Comments

@djhmateer
Copy link

If we have 3 lines:

a
b
c

And the cursor is on line b, and I press J. In Vim it would do:

a
b c

But here it does

a b
c

Not a big issue - just thought I'd add it :-) Thanks again.

@rcmdnk
Copy link
Owner

rcmdnk commented Apr 13, 2020

hmm...

As long as I tested on OneNote (or Notepad),
it works to make:

a
b c

by J at b.

It is implemented as: https://github.com/rcmdnk/vim_ahk/blob/master/lib/bind/vim_normal.ahk#L7

+j::Send, {Down}{Home}{BS}{Space}{Left}

You can try it by hand, then it should work like the above.

Only when you are at the last line (i.e. at c in the above example) of Notepad, it also makes

a
b c

At OneNote, Down cursor can go to the new line even if you do not have it,
then it does not change anything with J.

There may be a difference in environments.

Could you check {Down}{Home}{BS}{Space}{Left} directly in your environment
and tell me what happens?

@djhmateer
Copy link
Author

djhmateer commented Apr 13, 2020

Thanks. I've found it. For OneNote 2016 we need to send a ^ before the {Down} to get it to work.

+j::Send, ^{Down}{Home}{BS}{Space}{Left}

Would something like this be an appropriate fix:


if WinActive("ahk_group VimOneNoteGroup"){
+j::Send, ^{Down}{Home}{BS}{Space}{Left}
}

@rcmdnk
Copy link
Owner

rcmdnk commented Apr 13, 2020

Thanks, I remember that OneNote showed such a strange behavior beforehand,
and it changed at windows 10.

Therefore, VimOneNoteGroup was used for up/down move:
https://github.com/rcmdnk/vim_ahk/blob/master/lib/vim_move.ahk#L81

I put ^ for +j at v0.6.3, too.

I think there needs a lot of similar updates for {Up} and {Down}
for OneNote 2016,
but I don't have an environment and can not test.

If you can confirm something else, could you please let me know.

@djhmateer
Copy link
Author

Hi - will do. I'm using the bindings every day so I will make a list of OneNot 2016 strangeness and report back in another issue. Will close this one for now. Thank you!

@BlueDrink9
Copy link
Contributor

I've got a better fix for onenote's up and down in my fork btw, since ^up doesn't always have the right behaviour.

Also, is there a reason we don't implement J as {end}{delete} instead? That way it won't have incorrect behavior at the end of a file, as it would at the moment (try J on the last line of a file in vim vs vim.ahk).

@rcmdnk
Copy link
Owner

rcmdnk commented Apr 22, 2020

Thanks.

{end}{delete} (->{end}{space}{delete})

That is smarter and can be used for the old OneNote, too.
Updated: af4cd8e

In addition, the previous version had a bug that Return after the multiline key mapping was not implemented.
It made a bug to execute the next block, too by +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