Got incorrect result when replacing string which includes "[xxx]"
Description
When I try to replace the "[xxx]" (x is any char, count is 0~n) with something, the result seems not right.
Operation
e.g.
- select some string, e.g "test_string"
- press y to copy
- select from '[' to ']'. e.g. select "[abc]" in "TestFunc:[abc]"
- press p to replace
- The result we got is "TestFunctest_string:"
Expected behaviour
We should get "TestFunc:test_string". And VIM always can get the result expected on this scenario.
Environments
- Xcode Version [ 8.1 (8b62) ]
- XVim branch and revision [ didn't find where to check, downloaded ZIP on 20170222 ]
- Keyboard Language [ English ]
- Input source language [ English ]
I can recreate this. It seems like what happens is that if the selection you're replacing includes the last character of a line, then character right before the selection is pushed after what you replace. It doesn't depend on what you're replacing, as the title of this issue might suggest.
- Begin with the following text:
abc
def
- Yank the word
abc. - Cursor on
f, thenvpto replacefwithabc.
Result: dabce.
Expected: deabc.
If the same replacement is done with e selected in visual mode, the result is as expected: dabcf.
But, if ef is selected in visual mode, the same bug seems to happen: abcd instead of dabc.
In "About XVim":
XVim revision : fa5224bdc65c304bb49d079d0960a2f970e44462
OS Version : Version 10.12.3 (Build 16D32)
Xcode Version : 8.3.2