XVim icon indicating copy to clipboard operation
XVim copied to clipboard

Got incorrect result when replacing string which includes "[xxx]"

Open HonanLi opened this issue 8 years ago • 1 comments

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.

  1. select some string, e.g "test_string"
  2. press y to copy
  3. select from '[' to ']'. e.g. select "[abc]" in "TestFunc:[abc]"
  4. press p to replace
  5. 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 ]

HonanLi avatar Feb 25 '17 07:02 HonanLi

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.

  1. Begin with the following text:
abc
def
  1. Yank the word abc.
  2. Cursor on f, then vp to replace f with abc.

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

mossheim avatar Jul 26 '17 19:07 mossheim