]> git.pld-linux.org Git - packages/vim.git/blob - 7.3.210
- new
[packages/vim.git] / 7.3.210
1 To: vim_dev@googlegroups.com
2 Subject: Patch 7.3.210
3 Fcc: outbox
4 From: Bram Moolenaar <Bram@moolenaar.net>
5 Mime-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8 ------------
9
10 Patch 7.3.210
11 Problem:    Can't always find the file when using cscope.
12 Solution:   Add the 'cscoperelative' option. (Raghavendra D Prabhu)
13 Files:      runtime/doc/if_cscop.txt, runtime/doc/options.txt,
14             src/if_cscope.c, src/options.c, src/options.h
15
16
17 *** ../mercurial/vim73/runtime/doc/if_cscop.txt 2010-09-30 21:38:08.000000000 +0200
18 --- runtime/doc/if_cscop.txt    2011-06-12 19:54:26.000000000 +0200
19 ***************
20 *** 271,276 ****
21 --- 271,285 ----
22         :set cst
23         :set nocst
24   <
25 +                                                       *cscoperelative* *csre*
26 + If 'cscoperelative' set, then in absence of a prefix given to cscope (prefx
27 + is the argument to -P option of cscope), basename of cscope.out location
28 + (usually the project root directory) will be used as the prefix to construt
29 + absolute path.The default is off. Note: This option is only effective when
30 + cscope (cscopeprg) is initialized without a prefix path (-P). Examples: >
31 +       :set csre
32 +       :set nocsre
33 + <
34                                                         *cscopetagorder* *csto*
35   The value of 'csto' determines the order in which |:cstag| performs a search.
36   If 'csto' is set to zero, cscope database(s) are searched first, followed
37 *** ../mercurial/vim73/runtime/doc/options.txt  2011-05-19 12:22:41.000000000 +0200
38 --- runtime/doc/options.txt     2011-06-12 20:00:10.000000000 +0200
39 ***************
40 *** 2209,2214 ****
41 --- 2209,2224 ----
42         Specifies whether to use quickfix window to show cscope results.
43         See |cscopequickfix|.
44   
45 +                                               *'cscoperelative'* *'csre'*
46 + 'cscoperelative' 'csre' boolean (default off)
47 +                       global
48 +                       {not available when compiled without the |+cscope|
49 +                       feature}
50 +                       {not in Vi}
51 +       In the absence of a prefix (-P) for cscope. setting this option enables
52 +       to use the basename of cscope.out path as the prefix.
53 +       See |cscoperelative|.
54
55                                 *'cscopetag'* *'cst'* *'nocscopetag'* *'nocst'*
56   'cscopetag' 'cst'     boolean (default off)
57                         global
58 *** ../mercurial/vim73/src/if_cscope.c  2011-05-05 16:41:19.000000000 +0200
59 --- src/if_cscope.c     2011-06-12 20:25:17.000000000 +0200
60 ***************
61 *** 2471,2512 ****
62    */
63       static char *
64   cs_resolve_file(i, name)
65 !     int i;
66       char *name;
67   {
68 !     char *fullname;
69 !     int len;
70   
71       /*
72 !      * ppath is freed when we destroy the cscope connection.
73 !      * fullname is freed after cs_make_vim_style_matches, after it's been
74 !      * copied into the tag buffer used by vim
75        */
76       len = (int)(strlen(name) + 2);
77       if (csinfo[i].ppath != NULL)
78         len += (int)strlen(csinfo[i].ppath);
79   
80       if ((fullname = (char *)alloc(len)) == NULL)
81         return NULL;
82   
83 !     /*
84 !      * note/example: this won't work if the cscope output already starts
85        * "../.." and the prefix path is also "../..".  if something like this
86 !      * happens, you are screwed up and need to fix how you're using cscope.
87 !      */
88 !     if (csinfo[i].ppath != NULL &&
89 !       (strncmp(name, csinfo[i].ppath, strlen(csinfo[i].ppath)) != 0) &&
90 !       (name[0] != '/')
91   #ifdef WIN32
92 !       && name[0] != '\\' && name[1] != ':'
93   #endif
94 !       )
95         (void)sprintf(fullname, "%s/%s", csinfo[i].ppath, name);
96       else
97         (void)sprintf(fullname, "%s", name);
98   
99       return fullname;
100 ! } /* cs_resolve_file */
101   
102   
103   /*
104 --- 2471,2531 ----
105    */
106       static char *
107   cs_resolve_file(i, name)
108 !     int  i;
109       char *name;
110   {
111 !     char      *fullname;
112 !     int               len;
113 !     char_u    *csdir = NULL;
114   
115       /*
116 !      * Ppath is freed when we destroy the cscope connection.
117 !      * Fullname is freed after cs_make_vim_style_matches, after it's been
118 !      * copied into the tag buffer used by Vim.
119        */
120       len = (int)(strlen(name) + 2);
121       if (csinfo[i].ppath != NULL)
122         len += (int)strlen(csinfo[i].ppath);
123 +     else if (p_csre && csinfo[i].fname != NULL)
124 +     {
125 +       /* If 'cscoperelative' is set and ppath is not set, use cscope.out
126 +        * path in path resolution. */
127 +       csdir = alloc(MAXPATHL);
128 +       if (csdir != NULL)
129 +       {
130 +           vim_strncpy(csdir, (char_u *)csinfo[i].fname,
131 +                   gettail((char_u *)csinfo[i].fname) - 1 - (char_u *)csinfo[i].fname);
132 +           len += (int)STRLEN(csdir);
133 +       }
134 +     }
135   
136       if ((fullname = (char *)alloc(len)) == NULL)
137         return NULL;
138   
139 !     /* Note/example: this won't work if the cscope output already starts
140        * "../.." and the prefix path is also "../..".  if something like this
141 !      * happens, you are screwed up and need to fix how you're using cscope. */
142 !     if (csinfo[i].ppath != NULL
143 !           && (strncmp(name, csinfo[i].ppath, strlen(csinfo[i].ppath)) != 0)
144 !           && (name[0] != '/')
145   #ifdef WIN32
146 !           && name[0] != '\\' && name[1] != ':'
147   #endif
148 !        )
149         (void)sprintf(fullname, "%s/%s", csinfo[i].ppath, name);
150 +     else if (csdir != NULL && csinfo[i].fname != NULL && STRLEN(csdir) > 0)
151 +     {
152 +       /* Check for csdir to be non empty to avoid empty path concatenated to
153 +        * cscope output. TODO: avoid the unnecessary alloc/free of fullname. */
154 +       vim_free(fullname);
155 +       fullname = concat_fnames(csdir, (char_u *)name, TRUE);
156 +     }
157       else
158         (void)sprintf(fullname, "%s", name);
159   
160 +     vim_free(csdir);
161       return fullname;
162 ! }
163   
164   
165   /*
166 *** ../vim-7.3.209/src/version.c        2011-06-12 20:36:00.000000000 +0200
167 --- src/version.c       2011-06-12 20:37:48.000000000 +0200
168 ***************
169 *** 711,712 ****
170 --- 711,714 ----
171   {   /* Add new patch number below this line */
172 + /**/
173 +     210,
174   /**/
175
176 -- 
177 Apathy Error: Don't bother striking any key.
178
179  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
180 ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
181 \\\  an exciting new programming language -- http://www.Zimbu.org        ///
182  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
This page took 0.044536 seconds and 3 git commands to generate.