]>
Commit | Line | Data |
---|---|---|
2a3ba767 ER |
1 | To: vim-dev@vim.org |
2 | Subject: Patch 7.1.243 | |
3 | Fcc: outbox | |
4 | From: Bram Moolenaar <Bram@moolenaar.net> | |
5 | Mime-Version: 1.0 | |
6 | Content-Type: text/plain; charset=ISO-8859-1 | |
7 | Content-Transfer-Encoding: 8bit | |
8 | ------------ | |
9 | ||
10 | Patch 7.1.243 (after 7.1.240) | |
11 | Problem: "U" doesn't work on all text in Visual mode. (Adri Verhoef) | |
12 | Solution: Loop over all the lines to be changed. Add tests for this. | |
13 | Files: src/ops.c, src/testdir/test39.in, src/testdir/test39.ok | |
14 | ||
15 | ||
16 | *** ../vim-7.1.242/src/ops.c Tue Jan 22 16:01:25 2008 | |
17 | --- src/ops.c Mon Feb 4 22:23:22 2008 | |
18 | *************** | |
19 | *** 2197,2203 **** | |
20 | #ifdef FEAT_VISUAL | |
21 | struct block_def bd; | |
22 | #endif | |
23 | ! int did_change; | |
24 | ||
25 | if (u_save((linenr_T)(oap->start.lnum - 1), | |
26 | (linenr_T)(oap->end.lnum + 1)) == FAIL) | |
27 | --- 2197,2203 ---- | |
28 | #ifdef FEAT_VISUAL | |
29 | struct block_def bd; | |
30 | #endif | |
31 | ! int did_change = FALSE; | |
32 | ||
33 | if (u_save((linenr_T)(oap->start.lnum - 1), | |
34 | (linenr_T)(oap->end.lnum + 1)) == FAIL) | |
35 | *************** | |
36 | *** 2242,2248 **** | |
37 | else if (!oap->inclusive) | |
38 | dec(&(oap->end)); | |
39 | ||
40 | ! did_change = swapchars(oap->op_type, &pos, oap->end.col - pos.col + 1); | |
41 | if (did_change) | |
42 | { | |
43 | changed_lines(oap->start.lnum, oap->start.col, oap->end.lnum + 1, | |
44 | --- 2242,2259 ---- | |
45 | else if (!oap->inclusive) | |
46 | dec(&(oap->end)); | |
47 | ||
48 | ! if (pos.lnum == oap->end.lnum) | |
49 | ! did_change = swapchars(oap->op_type, &pos, | |
50 | ! oap->end.col - pos.col + 1); | |
51 | ! else | |
52 | ! for (;;) | |
53 | ! { | |
54 | ! did_change |= swapchars(oap->op_type, &pos, | |
55 | ! pos.lnum == oap->end.lnum ? oap->end.col + 1: | |
56 | ! (int)STRLEN(ml_get_pos(&pos))); | |
57 | ! if (ltoreq(oap->end, pos) || inc(&pos) == -1) | |
58 | ! break; | |
59 | ! } | |
60 | if (did_change) | |
61 | { | |
62 | changed_lines(oap->start.lnum, oap->start.col, oap->end.lnum + 1, | |
63 | *************** | |
64 | *** 2314,2330 **** | |
65 | for (todo = length; todo > 0; --todo) | |
66 | { | |
67 | # ifdef FEAT_MBYTE | |
68 | - int pos_col = pos->col; | |
69 | - | |
70 | if (has_mbyte) | |
71 | /* we're counting bytes, not characters */ | |
72 | todo -= (*mb_ptr2len)(ml_get_pos(pos)) - 1; | |
73 | # endif | |
74 | did_change |= swapchar(op_type, pos); | |
75 | - # ifdef FEAT_MBYTE | |
76 | - /* Changing German sharp s to SS increases the column. */ | |
77 | - todo += pos->col - pos_col; | |
78 | - # endif | |
79 | if (inc(pos) == -1) /* at end of file */ | |
80 | break; | |
81 | } | |
82 | --- 2325,2335 ---- | |
83 | *** ../vim-7.1.242/src/testdir/test39.in Sun Jun 13 18:21:09 2004 | |
84 | --- src/testdir/test39.in Wed Feb 6 13:57:37 2008 | |
85 | *************** | |
86 | *** 1,8 **** | |
87 | --- 1,10 ---- | |
88 | ||
89 | Test Visual block mode commands | |
90 | + And test "U" in Visual mode, also on German sharp S. | |
91 | ||
92 | STARTTEST | |
93 | :so small.vim | |
94 | + :so mbyte.vim | |
95 | /^abcde | |
96 | :" Test shift-right of a block | |
97 | jllll\16jj>wll\16jlll> | |
98 | *************** | |
99 | *** 14,20 **** | |
100 | Gllll\16kkklllrq | |
101 | :" Test block-change | |
102 | G$khhh\16hhkkcmno\e | |
103 | ! :$-4,$wq! test.out | |
104 | ENDTEST | |
105 | ||
106 | abcdefghijklm | |
107 | --- 16,37 ---- | |
108 | Gllll\16kkklllrq | |
109 | :" Test block-change | |
110 | G$khhh\16hhkkcmno\e | |
111 | ! :$-4,$w! test.out | |
112 |