Sending "XP" command in VI mode, when the cursor is in the beginning of the line crashes kate. Reproducible: Always Steps to Reproduce: 1. Open up kate. 2. Write some text 3. Change to VI mode. (Ctrl + Meta + V) 4. Move the cursor to the very beginning of the file. 5. Press "XP" in normal vi mode. Actual Results: Crash!
I'm working on the bug myself, and will send the patch soon.
Created attachment 82279 [details] Fix the bug, and add test case This should fix the bug, but I'm not sure if it does it the right way. The bug happened due to empty (but not null) register `"`, while pasting. According to the design of the code, it may be better to prevent the register from becoming an empty string. Also added a single test case.
Mehran: Cool, thanks for the patch! Simon: Can you take care of this?
Git commit 4c60f7181b326e111fb71a3242b19516b0d02250 by Simon St James. Committed on 11/09/2013 at 16:43. Pushed by sstjames into branch 'master'. Don't crash if we try to paste with an empty (but not null) register. Thanks to Mehran Kholdi for the patch and test-case! M +1 -1 part/vimode/katevinormalmode.cpp M +1 -0 tests/vimode_test.cpp http://commits.kde.org/kate/4c60f7181b326e111fb71a3242b19516b0d02250
"According to the design of the code, it may be better to prevent the register from becoming an empty string." The register starts off empty (there's not really a sensible non-empty default value to give a register) so your approach works best! I applied it without changes: thanks especially for taking time to give a test-case which fits in nicely with all the others!
Git commit 8a70d96e33862290720cfa4d9f84310c66505bd4 by Simon St James. Committed on 11/09/2013 at 16:43. Pushed by sstjames into branch 'KDE/4.11'. Don't crash if we try to paste with an empty (but not null) register. Thanks to Mehran Kholdi for the patch and test-case! cherry-picked from master. M +1 -1 part/vimode/katevinormalmode.cpp M +1 -0 tests/vimode_test.cpp http://commits.kde.org/kate/8a70d96e33862290720cfa4d9f84310c66505bd4