summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-01-02 18:00:27 +0100
committerBram Moolenaar <Bram@vim.org>2019-01-02 18:00:27 +0100
commit33c8ca923ed6d5638fa98afabb2e25b5056dd47b (patch)
tree33e389557ab7b0a3e6478eb14d7d3547397da122
parentc85ffc9daba6f66d5958ae80249d26f7f81bfced (diff)
patch 8.1.0681: text properties as not adjusted for deleted textv8.1.0681
Problem: Text properties as not adjusted for deleted text. Solution: Adjust text properties when backspacing to delete text.
-rw-r--r--src/edit.c1
-rw-r--r--src/misc1.c2
-rw-r--r--src/testdir/dumps/Test_textprop_01.dump4
-rw-r--r--src/testdir/test_textprop.vim24
-rw-r--r--src/version.c2
5 files changed, 29 insertions, 4 deletions
diff --git a/src/edit.c b/src/edit.c
index a522fe93bb..1b88f6140a 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -6737,7 +6737,6 @@ internal_format(
* comment leader for the numbered list. */
for (i = 0; i < padding; i++)
ins_str((char_u *)" ");
- changed_bytes(curwin->w_cursor.lnum, leader_len);
}
else
{
diff --git a/src/misc1.c b/src/misc1.c
index 692d5c769e..c2d2d19d2f 100644
--- a/src/misc1.c
+++ b/src/misc1.c
@@ -2749,7 +2749,7 @@ del_bytes(
#endif
// mark the buffer as changed and prepare for displaying
- changed_bytes(lnum, curwin->w_cursor.col);
+ inserted_bytes(lnum, curwin->w_cursor.col, -count);
return OK;
}
diff --git a/src/testdir/dumps/Test_textprop_01.dump b/src/testdir/dumps/Test_textprop_01.dump
index 98130a795e..8687a0ab88 100644
--- a/src/testdir/dumps/Test_textprop_01.dump
+++ b/src/testdir/dumps/Test_textprop_01.dump
@@ -1,6 +1,6 @@
| +0#af5f00255#ffffff0@1|1| |O+0#0000000&|n|e| +0&#ffff4012|t|w|o| +0&#ffffff0@63
| +0#af5f00255&@1|2| |N+0#0000000#ffff4012|u|m|b|é|r| |1+0#4040ff13&|2|3| +0#0000000&|ä|n|d| |t|h|œ|n| |4+0#4040ff13&|¾|7|.+0#0000000&| +0&#ffffff0@46
-| +0#af5f00255&@1|3| |-+0#0000000#ffff4012@1|x+0&#ffffff0|a+0#4040ff13&@1|x+0#0000000&|-@1|x+0#4040ff13&|b@1|x+0#0000000&|-@1|x|c+0#4040ff13&@1|x|-+0#0000000&@1|x+0#4040ff13&|d@1>x|-+0#0000000&@1| @44
+| +0#af5f00255&@1|3| >-+0#0000000#ffff4012|x+0&#ffffff0|a+0#4040ff13&@1|x+0#0000000&|-@1|x+0#4040ff13&|b@1|x+0#0000000&|-@1|x|c+0#4040ff13&@1|x|-+0#0000000&@1|x+0#4040ff13&|d@1|x|-+0#0000000&@1| @45
|~+0#4040ff13&| @73
|~| @73
-| +0#0000000&@56|3|,|2|4| @9|A|l@1|
+| +0#0000000&@56|3|,|1| @10|A|l@1|
diff --git a/src/testdir/test_textprop.vim b/src/testdir/test_textprop.vim
index d810dfc884..737ff209ee 100644
--- a/src/testdir/test_textprop.vim
+++ b/src/testdir/test_textprop.vim
@@ -177,6 +177,29 @@ func Test_prop_add_remove_buf()
bwipe!
endfunc
+func Test_prop_backspace()
+ new
+ set bs=2
+ call setline(1, 'xonex xtwoxx')
+ call AddPropTypes()
+ call prop_add(1, 2, {'length': 3, 'id': 11, 'type': 'one'})
+ call prop_add(1, 8, {'length': 3, 'id': 12, 'type': 'two'})
+ let expected = [
+ \ {'col': 2, 'length': 3, 'id': 11, 'type': 'one', 'start': 1, 'end': 1},
+ \ {'col': 8, 'length': 3, 'id': 12, 'type': 'two', 'start': 1, 'end': 1},
+ \]
+ call assert_equal(expected, prop_list(1))
+
+ exe "normal 0li\<BS>\<Esc>fxli\<BS>\<Esc>"
+ call assert_equal('one xtwoxx', getline(1))
+ let expected[0].col = 1
+ let expected[1].col = 6
+ call assert_equal(expected, prop_list(1))
+
+ call DeletePropTypes()
+ bwipe!
+ set bs&
+endfunc
func Test_prop_clear()
new
@@ -319,6 +342,7 @@ funct Test_textprop_screenshots()
\ "hi clear SpellBad",
\ "set spell",
\ "normal 3G0llix\<Esc>lllix\<Esc>lllix\<Esc>lllix\<Esc>lllix\<Esc>lllix\<Esc>lllix\<Esc>lllix\<Esc>",
+ \ "normal 3G0lli\<BS>\<Esc>",
\], 'XtestProp')
let buf = RunVimInTerminal('-S XtestProp', {'rows': 6})
call VerifyScreenDump(buf, 'Test_textprop_01', {})
diff --git a/src/version.c b/src/version.c
index 8dcd56f427..cd5e386de9 100644
--- a/src/version.c
+++ b/src/version.c
@@ -800,6 +800,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 681,
+/**/
680,
/**/
679,