]> git.pld-linux.org Git - packages/vim.git/blob - 6.2.287
- initial import
[packages/vim.git] / 6.2.287
1 To: vim-dev@vim.org
2 Subject: Patch 6.2.287
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.287 (after 6.2.264)
11 Problem:    Duplicate lines are added to the viminfo file.
12 Solution:   Compare with existing entries without an offset.  Also fixes
13             reading very long history lines from viminfo.
14 Files:      src/ex_getln.c
15
16
17 *** ../vim-6.2.286/src/ex_getln.c       Tue Feb 17 20:22:36 2004
18 --- src/ex_getln.c      Tue Feb 24 14:38:36 2004
19 ***************
20 *** 4742,4783 ****
21       vir_T     *virp;
22   {
23       int               type;
24 !     int               sep;
25 !     int               len;
26       char_u    *val;
27   
28       type = hist_char2type(virp->vir_line[0]);
29       if (viminfo_hisidx[type] < viminfo_hislen[type])
30       {
31 !       /* Use a zero offset, so that we have some extra space in the
32 !        * allocated memory for the separator. */
33 !       val = viminfo_readstring(virp, 0, TRUE);
34 !       if (val != NULL)
35         {
36 !           if (!in_history(type, val, viminfo_add_at_front))
37             {
38                 len = STRLEN(val);
39 !               if (type == HIST_SEARCH)
40 !               {
41 !                   /* Search entry: Move the separator from the second column
42 !                    * to after the NUL. */
43 !                   sep = val[1];
44 !                   --len;
45 !                   mch_memmove(val, val + 2, (size_t)len);
46 !                   val[len] = (sep == ' ' ? NUL : sep);
47 !               }
48 !               else
49                 {
50 !                   /* Not a search entry: No separator in the viminfo file,
51 !                    * add a NUL separator. */
52 !                   mch_memmove(val, val + 1, (size_t)len);
53 !                   val[len] = NUL;
54                 }
55 -               viminfo_history[type][viminfo_hisidx[type]++] = val;
56             }
57 -           else
58 -               vim_free(val);
59         }
60       }
61       return viminfo_readline(virp);
62   }
63 --- 4781,4823 ----
64       vir_T     *virp;
65   {
66       int               type;
67 !     long_u    len;
68       char_u    *val;
69 +     char_u    *p;
70   
71       type = hist_char2type(virp->vir_line[0]);
72       if (viminfo_hisidx[type] < viminfo_hislen[type])
73       {
74 !       val = viminfo_readstring(virp, 1, TRUE);
75 !       if (val != NULL && *val != NUL)
76         {
77 !           if (!in_history(type, val + (type == HIST_SEARCH),
78 !                                                       viminfo_add_at_front))
79             {
80 +               /* Need to re-allocate to append the separator byte. */
81                 len = STRLEN(val);
82 !               p = lalloc(len + 2, TRUE);
83 !               if (p != NULL)
84                 {
85 !                   if (type == HIST_SEARCH)
86 !                   {
87 !                       /* Search entry: Move the separator from the first
88 !                        * column to after the NUL. */
89 !                       mch_memmove(p, val + 1, (size_t)len);
90 !                       p[len] = (*val == ' ' ? NUL : *val);
91 !                   }
92 !                   else
93 !                   {
94 !                       /* Not a search entry: No separator in the viminfo
95 !                        * file, add a NUL separator. */
96 !                       mch_memmove(p, val, (size_t)len + 1);
97 !                       p[len + 1] = NUL;
98 !                   }
99 !                   viminfo_history[type][viminfo_hisidx[type]++] = p;
100                 }
101             }
102         }
103 +       vim_free(val);
104       }
105       return viminfo_readline(virp);
106   }
107 *** ../vim-6.2.286/src/version.c        Tue Feb 24 15:19:00 2004
108 --- src/version.c       Tue Feb 24 15:21:20 2004
109 ***************
110 *** 639,640 ****
111 --- 639,642 ----
112   {   /* Add new patch number below this line */
113 + /**/
114 +     287,
115   /**/
116
117 -- 
118 hundred-and-one symptoms of being an internet addict:
119 239. You think "surfing" is something you do on dry land.
120
121  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
122 ///        Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
123 \\\              Project leader for A-A-P -- http://www.A-A-P.org        ///
124  \\\  Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html  ///
This page took 0.039704 seconds and 3 git commands to generate.