[VIM Mode] Add g<up> g<down> commands
ClosedPublic

Authored by gikari on Mar 8 2020, 9:08 AM.

Details

Summary

Add twin commands for gj and gk for usage with standard
arrow keys.

BUG: 418486
FIXED-IN: 5.69

Test Plan
  1. Open document with large sentences, that span across multiple visual lines in Kate and use gj and gk commands in normal mode to move inside a line.
  2. Use g<down> and g<up> commands - the result must be the same, as using gj and gk commands.
  3. Repeat the same for visual mode.

Diff Detail

Repository
R39 KTextEditor
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
gikari created this revision.Mar 8 2020, 9:08 AM
Restricted Application added projects: Kate, Frameworks. · View Herald TranscriptMar 8 2020, 9:08 AM
Restricted Application added subscribers: kde-frameworks-devel, kwrite-devel. · View Herald Transcript
gikari requested review of this revision.Mar 8 2020, 9:08 AM
gikari edited the summary of this revision. (Show Details)Mar 8 2020, 10:18 AM

I like the patch, but please add a unit test before we commit this. See https://github.com/KDE/ktexteditor/tree/master/autotests/src/vimode
Could you add one? :)

gikari added a comment.Mar 9 2020, 9:18 PM

I am not sure where I should add it. Is it supposed to be a new pair of bug418486 .h/.cpp files? Or should the test reside inside keys.cpp in big intimidating 500 line wide MappingTest function?

The intimidating one :)

gikari updated this revision to Diff 77355.Mar 10 2020, 2:27 PM
  • Add unit-test

I added a unit test, but I do not know why it is failing. Actually I do not know if I've added it correctly at all. Help is very necsasary.

I will try to take a look as soon as I have time, if nobody else is faster.
Just to confirm: Your newly added test case doesn't pass or some other test case randomly fails?

Yes, my case.

I think, one issue is, that <down> and <up> don't work that way in the test framework.
I reformulated the test with \down and \up and moved the asserts to verifies.
This works for me, will push this, please take a look if that is ok for you, too.

cullmann accepted this revision.Mar 12 2020, 10:20 PM
This revision is now accepted and ready to land.Mar 12 2020, 10:20 PM
This revision was automatically updated to reflect the committed changes.

And btw., thanks a lot for taking care!
The vimode for sure has more need for love, if you have time ;=)