Bug 309191

Summary: Extra char removed on "select text -> delete selection -> undo -> delete selection", also when editing a placeholder in a snippet
Product: [Applications] kate Reporter: Ivan Shapovalov <intelfx>
Component: Vi Input ModeAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In:

Description Ivan Shapovalov 2012-10-29 11:47:36 UTC
An extra char is removed after selection when one deletes ("d") a text block previously re-selected by undoing ("u") a deletion of previously manually selected text.
Also this happens when one uses "c" to change a placeholder string when applying a snippet.

Reproducible: Always

Steps to Reproduce:
Starting in Vi's normal mode
1. "i", "test another", Esc
2. "2b", "ve" - selected is the word "test"
3. "d" - the word "test" is deleted, and a space before "another" is left intact
4. "u" - the word "test" is restored and selected again
5. "d" - the word "test" AND the space before "another" are deleted


Expected Results:  
Expected the step (5) to behave like the step (3).

Kate version is 3.9.2, but there is no matching option in "Version" field. KDE version is 4.9.2, Qt's - 4.8.3.
Comment 1 Simon St James 2013-07-11 18:48:02 UTC
Git commit 0a1f61640cb83efdf62344e05f87ced586cff825 by Simon St James.
Committed on 11/07/2013 at 18:40.
Pushed by sstjames into branch 'master'.

Looks like there was a bit of a misunderstanding about how either Kate Ranges, or just selections, actually work: the end of the selectionRange appears to be one space ahead of where I expected.  Fix earlier test, and add test for bug 309191, which was the motivating example for this.

M  +2    -1    part/vimode/katevivisualmode.cpp
M  +5    -2    tests/vimode_test.cpp

http://commits.kde.org/kate/0a1f61640cb83efdf62344e05f87ced586cff825
Comment 2 Simon St James 2013-07-11 18:55:36 UTC
Git commit 4a20941bcde1d048298750173366dadbd7aefc5d by Simon St James.
Committed on 11/07/2013 at 18:40.
Pushed by sstjames into branch 'KDE/4.11'.

Looks like there was a bit of a misunderstanding about how either Kate Ranges, or just selections, actually work: the end of the selectionRange appears to be one space ahead of where I expected.  Fix earlier test, and add test for bug 309191, which was the motivating example for this.

Backport of 0a1f61640c from master.

M  +2    -1    part/vimode/katevivisualmode.cpp
M  +5    -0    tests/vimode_test.cpp

http://commits.kde.org/kate/4a20941bcde1d048298750173366dadbd7aefc5d