mirror of
https://github.com/vim/vim.git
synced 2025-09-23 03:43:49 -04:00
updated for version 7.1-240
This commit is contained in:
64
src/ops.c
64
src/ops.c
@@ -2184,6 +2184,8 @@ op_replace(oap, c)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static int swapchars __ARGS((int op_type, pos_T *pos, int length));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Handle the (non-standard vi) tilde operator. Also for "gu", "gU" and "g?".
|
* Handle the (non-standard vi) tilde operator. Also for "gu", "gU" and "g?".
|
||||||
*/
|
*/
|
||||||
@@ -2194,9 +2196,8 @@ op_tilde(oap)
|
|||||||
pos_T pos;
|
pos_T pos;
|
||||||
#ifdef FEAT_VISUAL
|
#ifdef FEAT_VISUAL
|
||||||
struct block_def bd;
|
struct block_def bd;
|
||||||
int todo;
|
|
||||||
#endif
|
#endif
|
||||||
int did_change = 0;
|
int did_change;
|
||||||
|
|
||||||
if (u_save((linenr_T)(oap->start.lnum - 1),
|
if (u_save((linenr_T)(oap->start.lnum - 1),
|
||||||
(linenr_T)(oap->end.lnum + 1)) == FAIL)
|
(linenr_T)(oap->end.lnum + 1)) == FAIL)
|
||||||
@@ -2210,16 +2211,8 @@ op_tilde(oap)
|
|||||||
{
|
{
|
||||||
block_prep(oap, &bd, pos.lnum, FALSE);
|
block_prep(oap, &bd, pos.lnum, FALSE);
|
||||||
pos.col = bd.textcol;
|
pos.col = bd.textcol;
|
||||||
for (todo = bd.textlen; todo > 0; --todo)
|
did_change = swapchars(oap->op_type, &pos, bd.textlen);
|
||||||
{
|
|
||||||
# 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;
|
|
||||||
}
|
|
||||||
# ifdef FEAT_NETBEANS_INTG
|
# ifdef FEAT_NETBEANS_INTG
|
||||||
if (usingNetbeans && did_change)
|
if (usingNetbeans && did_change)
|
||||||
{
|
{
|
||||||
@@ -2249,13 +2242,7 @@ op_tilde(oap)
|
|||||||
else if (!oap->inclusive)
|
else if (!oap->inclusive)
|
||||||
dec(&(oap->end));
|
dec(&(oap->end));
|
||||||
|
|
||||||
while (ltoreq(pos, oap->end))
|
did_change = swapchars(oap->op_type, &pos, oap->end.col - pos.col + 1);
|
||||||
{
|
|
||||||
did_change |= swapchar(oap->op_type, &pos);
|
|
||||||
if (inc(&pos) == -1) /* at end of file */
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (did_change)
|
if (did_change)
|
||||||
{
|
{
|
||||||
changed_lines(oap->start.lnum, oap->start.col, oap->end.lnum + 1,
|
changed_lines(oap->start.lnum, oap->start.col, oap->end.lnum + 1,
|
||||||
@@ -2308,6 +2295,42 @@ op_tilde(oap)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Invoke swapchar() on "length" bytes at position "pos".
|
||||||
|
* "pos" is advanced to just after the changed characters.
|
||||||
|
* "length" is rounded up to include the whole last multi-byte character.
|
||||||
|
* Also works correctly when the number of bytes changes.
|
||||||
|
* Returns TRUE if some character was changed.
|
||||||
|
*/
|
||||||
|
static int
|
||||||
|
swapchars(op_type, pos, length)
|
||||||
|
int op_type;
|
||||||
|
pos_T *pos;
|
||||||
|
int length;
|
||||||
|
{
|
||||||
|
int todo;
|
||||||
|
int did_change = 0;
|
||||||
|
|
||||||
|
for (todo = length; todo > 0; --todo)
|
||||||
|
{
|
||||||
|
# ifdef FEAT_MBYTE
|
||||||
|
int pos_col = pos->col;
|
||||||
|
|
||||||
|
if (has_mbyte)
|
||||||
|
/* we're counting bytes, not characters */
|
||||||
|
todo -= (*mb_ptr2len)(ml_get_pos(pos)) - 1;
|
||||||
|
# endif
|
||||||
|
did_change |= swapchar(op_type, pos);
|
||||||
|
# ifdef FEAT_MBYTE
|
||||||
|
/* Changing German sharp s to SS increases the column. */
|
||||||
|
todo += pos->col - pos_col;
|
||||||
|
# endif
|
||||||
|
if (inc(pos) == -1) /* at end of file */
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return did_change;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If op_type == OP_UPPER: make uppercase,
|
* If op_type == OP_UPPER: make uppercase,
|
||||||
* if op_type == OP_LOWER: make lowercase,
|
* if op_type == OP_LOWER: make lowercase,
|
||||||
@@ -2330,7 +2353,8 @@ swapchar(op_type, pos)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
#ifdef FEAT_MBYTE
|
#ifdef FEAT_MBYTE
|
||||||
if (op_type == OP_UPPER && enc_latin1like && c == 0xdf)
|
if (op_type == OP_UPPER && c == 0xdf
|
||||||
|
&& (enc_latin1like || STRCMP(p_enc, "iso-8859-2") == 0))
|
||||||
{
|
{
|
||||||
pos_T sp = curwin->w_cursor;
|
pos_T sp = curwin->w_cursor;
|
||||||
|
|
||||||
|
@@ -666,6 +666,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
240,
|
||||||
/**/
|
/**/
|
||||||
239,
|
239,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user