summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/globals.h1
-rw-r--r--src/ops.c38
-rw-r--r--src/version.h4
3 files changed, 27 insertions, 16 deletions
diff --git a/src/globals.h b/src/globals.h
index 6bfc13dc7..29a643bc8 100644
--- a/src/globals.h
+++ b/src/globals.h
@@ -688,6 +688,7 @@ EXTERN int enc_dbcs INIT(= 0); /* One of DBCS_xxx values if
DBCS encoding */
EXTERN int enc_unicode INIT(= 0); /* 2: UCS-2 or UTF-16, 4: UCS-4 */
EXTERN int enc_utf8 INIT(= FALSE); /* UTF-8 encoded Unicode */
+EXTERN int enc_latin1like INIT(= TRUE); /* 'encoding' is latin1 comp. */
# ifdef WIN3264
/* Codepage nr of 'encoding'. Negative means it's not been set yet, zero
* means 'encoding' is not a valid codepage. */
diff --git a/src/ops.c b/src/ops.c
index 8be36e841..b1b22a430 100644
--- a/src/ops.c
+++ b/src/ops.c
@@ -2140,12 +2140,9 @@ op_tilde(oap)
pos_T pos;
#ifdef FEAT_VISUAL
struct block_def bd;
- int done;
#endif
+ int todo;
int did_change = 0;
-#ifdef FEAT_MBYTE
- colnr_T col;
-#endif
if (u_save((linenr_T)(oap->start.lnum - 1),
(linenr_T)(oap->end.lnum + 1)) == FAIL)
@@ -2159,19 +2156,15 @@ op_tilde(oap)
{
block_prep(oap, &bd, pos.lnum, FALSE);
pos.col = bd.textcol;
- for (done = 0; done < bd.textlen; ++done)
+ for (todo = bd.textlen; todo > 0; --todo)
{
+#ifdef FEAT_MBYTE
+ if (has_mbyte)
+ todo -= (*mb_ptr2len)(ml_get_pos(&pos)) - 1;
+#endif
did_change |= swapchar(oap->op_type, &pos);
-# ifdef FEAT_MBYTE
- col = pos.col + 1;
-# endif
if (inc(&pos) == -1) /* at end of file */
break;
-# ifdef FEAT_MBYTE
- if (pos.col > col)
- /* Count extra bytes of a multi-byte character. */
- done += pos.col - col;
-# endif
}
# ifdef FEAT_NETBEANS_INTG
if (usingNetbeans && did_change)
@@ -2202,8 +2195,12 @@ op_tilde(oap)
else if (!oap->inclusive)
dec(&(oap->end));
- while (ltoreq(pos, oap->end))
+ for (todo = oap->end.col - pos.col + 1; todo > 0; --todo)
{
+#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;
@@ -2282,6 +2279,19 @@ swapchar(op_type, pos)
return FALSE;
#ifdef FEAT_MBYTE
+ if (op_type == OP_UPPER && enc_latin1like && c == 0xdf)
+ {
+ pos_T sp = curwin->w_cursor;
+
+ /* Special handling of German sharp s: change to "SS". */
+ curwin->w_cursor = *pos;
+ del_char(FALSE);
+ ins_char('S');
+ ins_char('S');
+ curwin->w_cursor = sp;
+ inc(pos);
+ }
+
if (enc_dbcs != 0 && c >= 0x100) /* No lower/uppercase letter */
return FALSE;
#endif
diff --git a/src/version.h b/src/version.h
index 7e4ca1483..8c6465e21 100644
--- a/src/version.h
+++ b/src/version.h
@@ -36,5 +36,5 @@
#define VIM_VERSION_NODOT "vim70aa"
#define VIM_VERSION_SHORT "7.0aa"
#define VIM_VERSION_MEDIUM "7.0aa ALPHA"
-#define VIM_VERSION_LONG "VIM - Vi IMproved 7.0aa ALPHA (2005 Aug 23)"
-#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0aa ALPHA (2005 Aug 23, compiled "
+#define VIM_VERSION_LONG "VIM - Vi IMproved 7.0aa ALPHA (2005 Aug 24)"
+#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0aa ALPHA (2005 Aug 24, compiled "