vimode: fixed the cursor position in some cases of the "c" command in normal mode.
Review Request #114872 - Created Jan. 5, 2014 and submitted
|Miquel Sabaté Solà|
Consider the following text: "something". Before this patch, if you hit 'ci"' with the cursor in the first double quote character, the text is transformed into: "". This is correct, but in this specific case, the cursor is then left before the first double quote character instead of between the two double quote characters. With this patch, after transforming the text, the cursor is left inside the two double quote characters. This same issue appeared with other characters like ', <, >, etc. This is the same behavior as in vim.
I've added a few QCOMPARE's in the NormalModeMotionsTest() function. I've also tested this patch manually.
We generally write this kind of "cursor position" test by writing an X and checking the resulting string e.g. instead of DoTest("<a, b, c>", "ci>", "<>"); QCOMPARE(kate_view->cursorPosition().column(), 1); we do DoTest("<a, b, c>", "ci>X", "<X>"); This is a matter of taste (and, I suppose, consistency) though - I'm happy for you to commit the patch as is :)