char_u *newp;
linenr_T lnum = curwin->w_cursor.lnum;
colnr_T col = curwin->w_cursor.col;
+ char_u *old_line;
+ int deleted;
+ old_line = ml_get(lnum);
if (col == 0)
newp = vim_strsave((char_u *)"");
else
- newp = vim_strnsave(ml_get(lnum), col);
+ newp = vim_strnsave(old_line, col);
+ deleted = (int)STRLEN(old_line) - col;
if (newp == NULL)
return FAIL;
ml_replace(lnum, newp, FALSE);
// mark the buffer as changed and prepare for displaying
- changed_bytes(lnum, curwin->w_cursor.col);
+ inserted_bytes(lnum, curwin->w_cursor.col, -deleted);
// If "fixpos" is TRUE we don't want to end up positioned at the NUL.
if (fixpos && curwin->w_cursor.col > 0)
set bs&
endfunc
+func Test_prop_change()
+ new
+ let expected = SetupOneLine() " 'xonex xtwoxx'
+
+ " Characterwise.
+ exe "normal 7|c$\<Esc>"
+ call assert_equal('xonex ', getline(1))
+ call assert_equal(expected[:0], prop_list(1))
+ " Linewise.
+ exe "normal cc\<Esc>"
+ call assert_equal('', getline(1))
+ call assert_equal([], prop_list(1))
+
+ call DeletePropTypes()
+ bwipe!
+ set bs&
+endfunc
+
func Test_prop_replace()
new
set bs=2