diff src/ops.c @ 3421:fb2c5a51dac7 v7.3.476

updated for version 7.3.476 Problem: When selecting a block, using "$" to include the end of each line and using "A" and typing a backspace strange things happen. (Yuangchen Xie) Solution: Avoid using a negative length. (Christian Brabandt)
author Bram Moolenaar <bram@vim.org>
date Fri, 23 Mar 2012 14:16:23 +0100
parents df9c7798b5e2
children b1a42d2522fb
line wrap: on
line diff
--- a/src/ops.c
+++ b/src/ops.c
@@ -2602,7 +2602,8 @@ op_insert(oap, count1)
 	firstline = ml_get(oap->start.lnum) + bd.textcol;
 	if (oap->op_type == OP_APPEND)
 	    firstline += bd.textlen;
-	if ((ins_len = (long)STRLEN(firstline) - pre_textlen) > 0)
+	if (pre_textlen >= 0
+		     && (ins_len = (long)STRLEN(firstline) - pre_textlen) > 0)
 	{
 	    ins_text = vim_strnsave(firstline, (int)ins_len);
 	    if (ins_text != NULL)