summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.0681
blob: 8a94021f5ad88ffc2affd1fdc57c7249093cce9a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
To: vim_dev@googlegroups.com
Subject: Patch 8.1.0681
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 8.1.0681
Problem:    Text properties as not adjusted for deleted text.
Solution:   Adjust text properties when backspacing to delete text.
Files:	    src/edit.c, src/misc1.c, src/testdir/test_textprop.vim,
            src/testdir/dumps/Test_textprop_01.dump


*** ../vim-8.1.0680/src/edit.c	2018-12-23 19:10:05.006359935 +0100
--- src/edit.c	2019-01-02 17:56:21.973343178 +0100
***************
*** 6737,6743 ****
  			 * 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
  		    {
--- 6737,6742 ----
*** ../vim-8.1.0680/src/misc1.c	2019-01-02 00:02:07.603556175 +0100
--- src/misc1.c	2019-01-02 17:34:00.404745509 +0100
***************
*** 2749,2755 ****
  #endif
  
      // mark the buffer as changed and prepare for displaying
!     changed_bytes(lnum, curwin->w_cursor.col);
  
      return OK;
  }
--- 2749,2755 ----
  #endif
  
      // mark the buffer as changed and prepare for displaying
!     inserted_bytes(lnum, curwin->w_cursor.col, -count);
  
      return OK;
  }
*** ../vim-8.1.0680/src/testdir/test_textprop.vim	2019-01-02 00:02:07.607556145 +0100
--- src/testdir/test_textprop.vim	2019-01-02 17:48:09.373558703 +0100
***************
*** 177,182 ****
--- 177,205 ----
    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,324 ****
--- 342,348 ----
  	\ "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', {})
*** ../vim-8.1.0680/src/testdir/dumps/Test_textprop_01.dump	2019-01-02 00:02:07.607556145 +0100
--- src/testdir/dumps/Test_textprop_01.dump	2019-01-02 17:48:15.413507112 +0100
***************
*** 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#4040ff13&| @73
  |~| @73
! | +0#0000000&@56|3|,|2|4| @9|A|l@1| 
--- 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|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|,|1| @10|A|l@1| 
*** ../vim-8.1.0680/src/version.c	2019-01-02 17:26:25.552510223 +0100
--- src/version.c	2019-01-02 17:35:06.640192315 +0100
***************
*** 801,802 ****
--- 801,804 ----
  {   /* Add new patch number below this line */
+ /**/
+     681,
  /**/

-- 
I AM THANKFUL...
...for the piles of laundry and ironing because it means I
have plenty of clothes to wear.

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///