]>
Commit | Line | Data |
---|---|---|
eb0ac1ae AG |
1 | To: vim-dev@vim.org |
2 | Subject: Patch 6.2.147 | |
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 6.2.147 | |
11 | Problem: ":s/pat/\=col('.')" always replaces with "1". | |
12 | Solution: Set the cursor to the start of the match before substituting. | |
13 | (Helmut Stiegler) | |
14 | Files: src/ex_cmds.c | |
15 | ||
16 | ||
17 | *** ../vim-6.2.146/src/ex_cmds.c Sat Sep 27 19:36:46 2003 | |
18 | --- src/ex_cmds.c Fri Nov 7 16:12:26 2003 | |
19 | *************** | |
20 | *** 3896,3904 **** | |
21 | break; | |
22 | } | |
23 | ||
24 | ! /* Move the cursor to the start of the line, to avoid that it | |
25 | ! * is beyond the end of the line after the substitution. */ | |
26 | ! curwin->w_cursor.col = 0; | |
27 | ||
28 | /* | |
29 | * 3. substitute the string. | |
30 | --- 3896,3904 ---- | |
31 | break; | |
32 | } | |
33 | ||
34 | ! /* Move the cursor to the start of the match, so that we can | |
35 | ! * use "\=col("."). */ | |
36 | ! curwin->w_cursor.col = regmatch.startpos[0].col; | |
37 | ||
38 | /* | |
39 | * 3. substitute the string. | |
40 | *************** | |
41 | *** 3970,3975 **** | |
42 | --- 3970,3979 ---- | |
43 | sub, new_end, TRUE, p_magic, TRUE); | |
44 | sub_nsubs++; | |
45 | did_sub = TRUE; | |
46 | + | |
47 | + /* Move the cursor to the start of the line, to avoid that it | |
48 | + * is beyond the end of the line after the substitution. */ | |
49 | + curwin->w_cursor.col = 0; | |
50 | ||
51 | /* For a multi-line match, make a copy of the last matched | |
52 | * line and continue in that one. */ | |
53 | *** ../vim-6.2.146/src/version.c Sun Nov 9 20:20:26 2003 | |
54 | --- src/version.c Sun Nov 9 20:22:20 2003 | |
55 | *************** | |
56 | *** 639,640 **** | |
57 | --- 639,642 ---- | |
58 | { /* Add new patch number below this line */ | |
59 | + /**/ | |
60 | + 147, | |
61 | /**/ | |
62 | ||
63 | -- | |
64 | I once paid $12 to peer at the box that held King Tutankhamen's little | |
65 | bandage-covered midget corpse at the De Young Museum in San Francisco. I | |
66 | remember thinking how pleased he'd be about the way things turned out in his | |
67 | afterlife. | |
68 | (Scott Adams - The Dilbert principle) | |
69 | ||
70 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
71 | /// Creator of Vim - Vi IMproved -- http://www.Vim.org \\\ | |
72 | \\\ Project leader for A-A-P -- http://www.A-A-P.org /// | |
73 | \\\ Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html /// |