diff src/ops.c @ 530:339999b511a0 v7.0148

updated for version 7.0148
author vimboss
date Fri, 16 Sep 2005 21:55:43 +0000
parents 06364aa0d597
children a5efb97bc104
line wrap: on
line diff
--- a/src/ops.c
+++ b/src/ops.c
@@ -2140,8 +2140,8 @@ op_tilde(oap)
     pos_T		pos;
 #ifdef FEAT_VISUAL
     struct block_def	bd;
-#endif
     int			todo;
+#endif
     int			did_change = 0;
 
     if (u_save((linenr_T)(oap->start.lnum - 1),
@@ -2158,10 +2158,10 @@ op_tilde(oap)
 	    pos.col = bd.textcol;
 	    for (todo = bd.textlen; todo > 0; --todo)
 	    {
-#ifdef FEAT_MBYTE
+# ifdef FEAT_MBYTE
 		if (has_mbyte)
 		    todo -= (*mb_ptr2len)(ml_get_pos(&pos)) - 1;
-#endif
+# endif
 		did_change |= swapchar(oap->op_type, &pos);
 		if (inc(&pos) == -1)	    /* at end of file */
 		    break;
@@ -2195,16 +2195,13 @@ op_tilde(oap)
 	else if (!oap->inclusive)
 	    dec(&(oap->end));
 
-	for (todo = oap->end.col - pos.col + 1; todo > 0; --todo)
+	while (ltoreq(pos, oap->end))
 	{
-#ifdef FEAT_MBYTE
-	    if (has_mbyte)
-		todo -= (*mb_ptr2len)(ml_get_pos(&pos)) - 1;
-#endif
 	    did_change |= swapchar(oap->op_type, &pos);
 	    if (inc(&pos) == -1)    /* at end of file */
 		break;
 	}
+
 	if (did_change)
 	{
 	    changed_lines(oap->start.lnum, oap->start.col, oap->end.lnum + 1,