updated for version 7.4.680

Problem:    CTRL-W in Insert mode does not work well for multi-byte
            characters.
Solution:   Use mb_get_class(). (Yasuhiro Matsumoto)
This commit is contained in:
Bram Moolenaar
2015-03-24 17:49:51 +01:00
parent 6383b92d8c
commit 310f2d59b2
8 changed files with 87 additions and 56 deletions

View File

@ -9047,23 +9047,44 @@ ins_bs(c, mode, inserted_space_p)
/* /*
* Delete upto starting point, start of line or previous word. * Delete upto starting point, start of line or previous word.
*/ */
else do else
{
#ifdef FEAT_MBYTE
int cclass = 0, prev_cclass = 0;
if (has_mbyte)
cclass = mb_get_class(ml_get_cursor());
#endif
do
{ {
#ifdef FEAT_RIGHTLEFT #ifdef FEAT_RIGHTLEFT
if (!revins_on) /* put cursor on char to be deleted */ if (!revins_on) /* put cursor on char to be deleted */
#endif #endif
dec_cursor(); dec_cursor();
cc = gchar_cursor();
#ifdef FEAT_MBYTE
/* look multi-byte character class */
if (has_mbyte)
{
prev_cclass = cclass;
cclass = mb_get_class(ml_get_cursor());
}
#endif
/* start of word? */ /* start of word? */
if (mode == BACKSPACE_WORD && !vim_isspace(gchar_cursor())) if (mode == BACKSPACE_WORD && !vim_isspace(cc))
{ {
mode = BACKSPACE_WORD_NOT_SPACE; mode = BACKSPACE_WORD_NOT_SPACE;
temp = vim_iswordc(gchar_cursor()); temp = vim_iswordc(cc);
} }
/* end of word? */ /* end of word? */
else if (mode == BACKSPACE_WORD_NOT_SPACE else if (mode == BACKSPACE_WORD_NOT_SPACE
&& (vim_isspace(cc = gchar_cursor()) && ((vim_isspace(cc) || vim_iswordc(cc) != temp)
|| vim_iswordc(cc) != temp)) #ifdef FEAT_MBYTE
|| prev_cclass != cclass
#endif
))
{ {
#ifdef FEAT_RIGHTLEFT #ifdef FEAT_RIGHTLEFT
if (!revins_on) if (!revins_on)
@ -9113,6 +9134,7 @@ ins_bs(c, mode, inserted_space_p)
(curwin->w_cursor.col > mincol (curwin->w_cursor.col > mincol
&& (curwin->w_cursor.lnum != Insstart_orig.lnum && (curwin->w_cursor.lnum != Insstart_orig.lnum
|| curwin->w_cursor.col != Insstart_orig.col))); || curwin->w_cursor.col != Insstart_orig.col)));
}
did_backspace = TRUE; did_backspace = TRUE;
} }
#ifdef FEAT_SMARTINDENT #ifdef FEAT_SMARTINDENT

View File

@ -43,6 +43,7 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \
test_changelist.out \ test_changelist.out \
test_close_count.out \ test_close_count.out \
test_command_count.out \ test_command_count.out \
test_erasebackword.out \
test_eval.out \ test_eval.out \
test_insertcount.out \ test_insertcount.out \
test_listlbr.out \ test_listlbr.out \
@ -185,6 +186,7 @@ test_breakindent.out: test_breakindent.in
test_changelist.out: test_changelist.in test_changelist.out: test_changelist.in
test_close_count.out: test_close_count.in test_close_count.out: test_close_count.in
test_command_count.out: test_command_count.in test_command_count.out: test_command_count.in
test_erasebackword.out: test_erasebackword.in
test_eval.out: test_eval.in test_eval.out: test_eval.in
test_insertcount.out: test_insertcount.in test_insertcount.out: test_insertcount.in
test_listlbr.out: test_listlbr.in test_listlbr.out: test_listlbr.in

View File

@ -42,6 +42,7 @@ SCRIPTS = test3.out test4.out test5.out test6.out test7.out \
test_changelist.out \ test_changelist.out \
test_close_count.out \ test_close_count.out \
test_command_count.out \ test_command_count.out \
test_erasebackword.out \
test_eval.out \ test_eval.out \
test_insertcount.out \ test_insertcount.out \
test_listlbr.out \ test_listlbr.out \

View File

@ -64,6 +64,7 @@ SCRIPTS = test3.out test4.out test5.out test6.out test7.out \
test_changelist.out \ test_changelist.out \
test_close_count.out \ test_close_count.out \
test_command_count.out \ test_command_count.out \
test_erasebackword.out \
test_eval.out \ test_eval.out \
test_insertcount.out \ test_insertcount.out \
test_listlbr.out \ test_listlbr.out \

View File

@ -44,6 +44,7 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \
test_changelist.out \ test_changelist.out \
test_close_count.out \ test_close_count.out \
test_command_count.out \ test_command_count.out \
test_erasebackword.out \
test_eval.out \ test_eval.out \
test_insertcount.out \ test_insertcount.out \
test_listlbr.out \ test_listlbr.out \

View File

@ -4,7 +4,7 @@
# Authors: Zoltan Arpadffy, <arpadffy@polarhome.com> # Authors: Zoltan Arpadffy, <arpadffy@polarhome.com>
# Sandor Kopanyi, <sandor.kopanyi@mailbox.hu> # Sandor Kopanyi, <sandor.kopanyi@mailbox.hu>
# #
# Last change: 2015 Mar 13 # Last change: 2015 Mar 24
# #
# This has been tested on VMS 6.2 to 8.3 on DEC Alpha, VAX and IA64. # This has been tested on VMS 6.2 to 8.3 on DEC Alpha, VAX and IA64.
# Edit the lines in the Configuration section below to select. # Edit the lines in the Configuration section below to select.
@ -103,6 +103,7 @@ SCRIPT = test1.out test2.out test3.out test4.out test5.out \
test_changelist.out \ test_changelist.out \
test_close_count.out \ test_close_count.out \
test_command_count.out \ test_command_count.out \
test_erasebackword.out \
test_eval.out \ test_eval.out \
test_insertcount.out \ test_insertcount.out \
test_listlbr.out \ test_listlbr.out \

View File

@ -40,6 +40,7 @@ SCRIPTS = test1.out test2.out test3.out test4.out test5.out test6.out \
test_changelist.out \ test_changelist.out \
test_close_count.out \ test_close_count.out \
test_command_count.out \ test_command_count.out \
test_erasebackword.out \
test_eval.out \ test_eval.out \
test_insertcount.out \ test_insertcount.out \
test_listlbr.out \ test_listlbr.out \

View File

@ -741,6 +741,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 */
/**/
680,
/**/ /**/
679, 679,
/**/ /**/