summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2015-03-24 17:49:51 +0100
committerBram Moolenaar <Bram@vim.org>2015-03-24 17:49:51 +0100
commit310f2d59b2b20c642088feb5e6dfe323cc570923 (patch)
treed919b5b1fc437d2a254075a3db6af93aa1c3ff93
parent6383b92d8c272f75d1fe144f75e2e35ad7e11b04 (diff)
downloadvim-git-310f2d59b2b20c642088feb5e6dfe323cc570923.tar.gz
updated for version 7.4.680v7.4.680
Problem: CTRL-W in Insert mode does not work well for multi-byte characters. Solution: Use mb_get_class(). (Yasuhiro Matsumoto)
-rw-r--r--src/edit.c120
-rw-r--r--src/testdir/Make_amiga.mak2
-rw-r--r--src/testdir/Make_dos.mak1
-rw-r--r--src/testdir/Make_ming.mak1
-rw-r--r--src/testdir/Make_os2.mak1
-rw-r--r--src/testdir/Make_vms.mms3
-rw-r--r--src/testdir/Makefile1
-rw-r--r--src/version.c2
8 files changed, 81 insertions, 50 deletions
diff --git a/src/edit.c b/src/edit.c
index 9f7f1d6a2..75fe69172 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -9047,72 +9047,94 @@ ins_bs(c, mode, inserted_space_p)
/*
* 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
- if (!revins_on) /* put cursor on char to be deleted */
+ if (!revins_on) /* put cursor on char to be deleted */
#endif
- dec_cursor();
+ dec_cursor();
- /* start of word? */
- if (mode == BACKSPACE_WORD && !vim_isspace(gchar_cursor()))
- {
- mode = BACKSPACE_WORD_NOT_SPACE;
- temp = vim_iswordc(gchar_cursor());
- }
- /* end of word? */
- else if (mode == BACKSPACE_WORD_NOT_SPACE
- && (vim_isspace(cc = gchar_cursor())
- || vim_iswordc(cc) != temp))
- {
+ 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? */
+ if (mode == BACKSPACE_WORD && !vim_isspace(cc))
+ {
+ mode = BACKSPACE_WORD_NOT_SPACE;
+ temp = vim_iswordc(cc);
+ }
+ /* end of word? */
+ else if (mode == BACKSPACE_WORD_NOT_SPACE
+ && ((vim_isspace(cc) || vim_iswordc(cc) != temp)
+#ifdef FEAT_MBYTE
+ || prev_cclass != cclass
+#endif
+ ))
+ {
#ifdef FEAT_RIGHTLEFT
- if (!revins_on)
+ if (!revins_on)
#endif
- inc_cursor();
+ inc_cursor();
#ifdef FEAT_RIGHTLEFT
- else if (State & REPLACE_FLAG)
- dec_cursor();
+ else if (State & REPLACE_FLAG)
+ dec_cursor();
#endif
- break;
- }
- if (State & REPLACE_FLAG)
- replace_do_bs(-1);
- else
- {
+ break;
+ }
+ if (State & REPLACE_FLAG)
+ replace_do_bs(-1);
+ else
+ {
#ifdef FEAT_MBYTE
- if (enc_utf8 && p_deco)
- (void)utfc_ptr2char(ml_get_cursor(), cpc);
+ if (enc_utf8 && p_deco)
+ (void)utfc_ptr2char(ml_get_cursor(), cpc);
#endif
- (void)del_char(FALSE);
+ (void)del_char(FALSE);
#ifdef FEAT_MBYTE
- /*
- * If there are combining characters and 'delcombine' is set
- * move the cursor back. Don't back up before the base
- * character.
- */
- if (enc_utf8 && p_deco && cpc[0] != NUL)
- inc_cursor();
+ /*
+ * If there are combining characters and 'delcombine' is set
+ * move the cursor back. Don't back up before the base
+ * character.
+ */
+ if (enc_utf8 && p_deco && cpc[0] != NUL)
+ inc_cursor();
#endif
#ifdef FEAT_RIGHTLEFT
- if (revins_chars)
- {
- revins_chars--;
- revins_legal++;
+ if (revins_chars)
+ {
+ revins_chars--;
+ revins_legal++;
+ }
+ if (revins_on && gchar_cursor() == NUL)
+ break;
+#endif
}
- if (revins_on && gchar_cursor() == NUL)
+ /* Just a single backspace?: */
+ if (mode == BACKSPACE_CHAR)
break;
-#endif
- }
- /* Just a single backspace?: */
- if (mode == BACKSPACE_CHAR)
- break;
- } while (
+ } while (
#ifdef FEAT_RIGHTLEFT
- revins_on ||
+ revins_on ||
#endif
- (curwin->w_cursor.col > mincol
- && (curwin->w_cursor.lnum != Insstart_orig.lnum
- || curwin->w_cursor.col != Insstart_orig.col)));
+ (curwin->w_cursor.col > mincol
+ && (curwin->w_cursor.lnum != Insstart_orig.lnum
+ || curwin->w_cursor.col != Insstart_orig.col)));
+ }
did_backspace = TRUE;
}
#ifdef FEAT_SMARTINDENT
diff --git a/src/testdir/Make_amiga.mak b/src/testdir/Make_amiga.mak
index cc4af8934..a9a6fa63e 100644
--- a/src/testdir/Make_amiga.mak
+++ b/src/testdir/Make_amiga.mak
@@ -43,6 +43,7 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \
test_changelist.out \
test_close_count.out \
test_command_count.out \
+ test_erasebackword.out \
test_eval.out \
test_insertcount.out \
test_listlbr.out \
@@ -185,6 +186,7 @@ test_breakindent.out: test_breakindent.in
test_changelist.out: test_changelist.in
test_close_count.out: test_close_count.in
test_command_count.out: test_command_count.in
+test_erasebackword.out: test_erasebackword.in
test_eval.out: test_eval.in
test_insertcount.out: test_insertcount.in
test_listlbr.out: test_listlbr.in
diff --git a/src/testdir/Make_dos.mak b/src/testdir/Make_dos.mak
index fcd81b54d..e11027756 100644
--- a/src/testdir/Make_dos.mak
+++ b/src/testdir/Make_dos.mak
@@ -42,6 +42,7 @@ SCRIPTS = test3.out test4.out test5.out test6.out test7.out \
test_changelist.out \
test_close_count.out \
test_command_count.out \
+ test_erasebackword.out \
test_eval.out \
test_insertcount.out \
test_listlbr.out \
diff --git a/src/testdir/Make_ming.mak b/src/testdir/Make_ming.mak
index 3e6a50fb4..4ec49d505 100644
--- a/src/testdir/Make_ming.mak
+++ b/src/testdir/Make_ming.mak
@@ -64,6 +64,7 @@ SCRIPTS = test3.out test4.out test5.out test6.out test7.out \
test_changelist.out \
test_close_count.out \
test_command_count.out \
+ test_erasebackword.out \
test_eval.out \
test_insertcount.out \
test_listlbr.out \
diff --git a/src/testdir/Make_os2.mak b/src/testdir/Make_os2.mak
index 31023ea85..7cdfcb105 100644
--- a/src/testdir/Make_os2.mak
+++ b/src/testdir/Make_os2.mak
@@ -44,6 +44,7 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \
test_changelist.out \
test_close_count.out \
test_command_count.out \
+ test_erasebackword.out \
test_eval.out \
test_insertcount.out \
test_listlbr.out \
diff --git a/src/testdir/Make_vms.mms b/src/testdir/Make_vms.mms
index 7448d724f..496f8228a 100644
--- a/src/testdir/Make_vms.mms
+++ b/src/testdir/Make_vms.mms
@@ -4,7 +4,7 @@
# Authors: Zoltan Arpadffy, <arpadffy@polarhome.com>
# 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.
# 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_close_count.out \
test_command_count.out \
+ test_erasebackword.out \
test_eval.out \
test_insertcount.out \
test_listlbr.out \
diff --git a/src/testdir/Makefile b/src/testdir/Makefile
index 966183686..bc094e176 100644
--- a/src/testdir/Makefile
+++ b/src/testdir/Makefile
@@ -40,6 +40,7 @@ SCRIPTS = test1.out test2.out test3.out test4.out test5.out test6.out \
test_changelist.out \
test_close_count.out \
test_command_count.out \
+ test_erasebackword.out \
test_eval.out \
test_insertcount.out \
test_listlbr.out \
diff --git a/src/version.c b/src/version.c
index a43522eee..b08c010fa 100644
--- a/src/version.c
+++ b/src/version.c
@@ -742,6 +742,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 680,
+/**/
679,
/**/
678,