]> git.pld-linux.org Git - packages/vim.git/blob - 7.1.058
- typo
[packages/vim.git] / 7.1.058
1 To: vim-dev@vim.org
2 Subject: patch 7.1.058
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.058
11 Problem:    When 'rightleft' is set the completion menu is positioned wrong.
12             (Baha-Eddine MOKADEM)
13 Solution:   Fix the completion menu. (Martin Toft)
14 Files:      src/popupmnu.c, src/proto/search.pro, src/search.c
15
16
17 *** ../vim-7.1.057/src/popupmnu.c       Thu Jun 28 21:23:52 2007
18 --- src/popupmnu.c      Wed Aug  1 15:43:06 2007
19 ***************
20 *** 75,81 ****
21   
22       row = curwin->w_cline_row + W_WINROW(curwin);
23       height = curwin->w_cline_height;
24 -     col = curwin->w_wcol + W_WINCOL(curwin) - curwin->w_leftcol;
25   
26       if (firstwin->w_p_pvw)
27         top_clear = firstwin->w_height;
28 --- 75,80 ----
29 ***************
30 *** 167,172 ****
31 --- 166,180 ----
32       pum_base_width = max_width;
33       pum_kind_width = kind_width;
34   
35 +     /* Calculate column */
36 + #ifdef FEAT_RIGHTLEFT
37 +     if (curwin->w_p_rl)
38 +       col = W_WINCOL(curwin) + W_WIDTH(curwin) - curwin->w_wcol -
39 +                                                       curwin->w_leftcol - 1;
40 +     else
41 + #endif
42 +       col = W_WINCOL(curwin) + curwin->w_wcol - curwin->w_leftcol;
43
44       /* if there are more items than room we need a scrollbar */
45       if (pum_height < size)
46       {
47 ***************
48 *** 179,189 ****
49       if (def_width < max_width)
50         def_width = max_width;
51   
52 !     if (col < Columns - PUM_DEF_WIDTH || col < Columns - max_width)
53       {
54         /* align pum column with "col" */
55         pum_col = col;
56 !       pum_width = Columns - pum_col - pum_scrollbar;
57         if (pum_width > max_width + kind_width + extra_width + 1
58                                                  && pum_width > PUM_DEF_WIDTH)
59         {
60 --- 187,209 ----
61       if (def_width < max_width)
62         def_width = max_width;
63   
64 !     if (((col < Columns - PUM_DEF_WIDTH || col < Columns - max_width)
65 ! #ifdef FEAT_RIGHTLEFT
66 !               && !curwin->w_p_rl)
67 !           || (curwin->w_p_rl && (col > PUM_DEF_WIDTH || col > max_width)
68 ! #endif
69 !        ))
70       {
71         /* align pum column with "col" */
72         pum_col = col;
73
74 ! #ifdef FEAT_RIGHTLEFT
75 !       if (curwin->w_p_rl)
76 !           pum_width = pum_col - pum_scrollbar + 1;
77 !       else
78 ! #endif
79 !           pum_width = Columns - pum_col - pum_scrollbar;
80
81         if (pum_width > max_width + kind_width + extra_width + 1
82                                                  && pum_width > PUM_DEF_WIDTH)
83         {
84 ***************
85 *** 195,208 ****
86       else if (Columns < def_width)
87       {
88         /* not enough room, will use what we have */
89 !       pum_col = 0;
90         pum_width = Columns - 1;
91       }
92       else
93       {
94         if (max_width > PUM_DEF_WIDTH)
95             max_width = PUM_DEF_WIDTH;  /* truncate */
96 !       pum_col = Columns - max_width;
97         pum_width = max_width - pum_scrollbar;
98       }
99   
100 --- 215,238 ----
101       else if (Columns < def_width)
102       {
103         /* not enough room, will use what we have */
104 ! #ifdef FEAT_RIGHTLEFT
105 !       if (curwin->w_p_rl)
106 !           pum_col = Columns - 1;
107 !       else
108 ! #endif
109 !           pum_col = 0;
110         pum_width = Columns - 1;
111       }
112       else
113       {
114         if (max_width > PUM_DEF_WIDTH)
115             max_width = PUM_DEF_WIDTH;  /* truncate */
116 ! #ifdef FEAT_RIGHTLEFT
117 !       if (curwin->w_p_rl)
118 !           pum_col = max_width - 1;
119 !       else
120 ! #endif
121 !           pum_col = Columns - max_width;
122         pum_width = max_width - pum_scrollbar;
123       }
124   
125 ***************
126 *** 255,262 ****
127         attr = (idx == pum_selected) ? attr_select : attr_norm;
128   
129         /* prepend a space if there is room */
130 !       if (pum_col > 0)
131 !           screen_putchar(' ', row, pum_col - 1, attr);
132   
133         /* Display each entry, use two spaces for a Tab.
134          * Do this 3 times: For the main text, kind and extra info */
135 --- 285,300 ----
136         attr = (idx == pum_selected) ? attr_select : attr_norm;
137   
138         /* prepend a space if there is room */
139 ! #ifdef FEAT_RIGHTLEFT
140 !       if (curwin->w_p_rl)
141 !       {
142 !           if (pum_col < W_WINCOL(curwin) + W_WIDTH(curwin) - 1)
143 !               screen_putchar(' ', row, pum_col + 1, attr);
144 !       }
145 !       else
146 ! #endif
147 !           if (pum_col > 0)
148 !               screen_putchar(' ', row, pum_col - 1, attr);
149   
150         /* Display each entry, use two spaces for a Tab.
151          * Do this 3 times: For the main text, kind and extra info */
152 ***************
153 *** 282,307 ****
154                     {
155                         /* Display the text that fits or comes before a Tab.
156                          * First convert it to printable characters. */
157 !                       char_u *st;
158 !                       int  saved = *p;
159   
160                         *p = NUL;
161                         st = transstr(s);
162                         *p = saved;
163 !                       if (st != NULL)
164                         {
165 !                           screen_puts_len(st, (int)STRLEN(st), row, col,
166                                                                         attr);
167 !                           vim_free(st);
168                         }
169 -                       col += width;
170   
171                         if (*p != TAB)
172                             break;
173   
174                         /* Display two spaces for a Tab. */
175 !                       screen_puts_len((char_u *)"  ", 2, row, col, attr);
176 !                       col += 2;
177                         totwidth += 2;
178                         s = NULL;           /* start text at next char */
179                         width = 0;
180 --- 320,386 ----
181                     {
182                         /* Display the text that fits or comes before a Tab.
183                          * First convert it to printable characters. */
184 !                       char_u  *st;
185 !                       int     saved = *p;
186   
187                         *p = NUL;
188                         st = transstr(s);
189                         *p = saved;
190 ! #ifdef FEAT_RIGHTLEFT
191 !                       if (curwin->w_p_rl)
192                         {
193 !                           if (st != NULL)
194 !                           {
195 !                               char_u  *rt = reverse_text(st);
196 !                               char_u  *rt_saved = rt;
197 !                               int     len, j;
198
199 !                               if (rt != NULL)
200 !                               {
201 !                                   len = STRLEN(rt);
202 !                                   if (len > pum_width)
203 !                                   {
204 !                                       for (j = pum_width; j < len; ++j)
205 !                                           mb_ptr_adv(rt);
206 !                                       len = pum_width;
207 !                                   }
208 !                                   screen_puts_len(rt, len, row,
209 !                                                       col - len + 1, attr);
210 !                                   vim_free(rt_saved);
211 !                               }
212 !                               vim_free(st);
213 !                           }
214 !                           col -= width;
215 !                       }
216 !                       else
217 ! #endif
218 !                       {
219 !                           if (st != NULL)
220 !                           {
221 !                               screen_puts_len(st, (int)STRLEN(st), row, col,
222                                                                         attr);
223 !                               vim_free(st);
224 !                           }
225 !                           col += width;
226                         }
227   
228                         if (*p != TAB)
229                             break;
230   
231                         /* Display two spaces for a Tab. */
232 ! #ifdef FEAT_RIGHTLEFT
233 !                       if (curwin->w_p_rl)
234 !                       {
235 !                           screen_puts_len((char_u *)"  ", 2, row, col - 1,
236 !                                                                       attr);
237 !                           col -= 2;
238 !                       }
239 !                       else
240 ! #endif
241 !                       {
242 !                           screen_puts_len((char_u *)"  ", 2, row, col, attr);
243 !                           col += 2;
244 !                       }
245                         totwidth += 2;
246                         s = NULL;           /* start text at next char */
247                         width = 0;
248 ***************
249 *** 322,338 ****
250                                           && pum_array[idx].pum_extra == NULL)
251                     || pum_base_width + n >= pum_width)
252                 break;
253 !           screen_fill(row, row + 1, col, pum_col + pum_base_width + n,
254                                                               ' ', ' ', attr);
255 !           col = pum_col + pum_base_width + n;
256             totwidth = pum_base_width + n;
257         }
258   
259 !       screen_fill(row, row + 1, col, pum_col + pum_width, ' ', ' ', attr);
260         if (pum_scrollbar > 0)
261 !           screen_putchar(' ', row, pum_col + pum_width,
262 !                   i >= thumb_pos && i < thumb_pos + thumb_heigth
263                                                   ? attr_thumb : attr_scroll);
264   
265         ++row;
266       }
267 --- 401,444 ----
268                                           && pum_array[idx].pum_extra == NULL)
269                     || pum_base_width + n >= pum_width)
270                 break;
271 ! #ifdef FEAT_RIGHTLEFT
272 !           if (curwin->w_p_rl)
273 !           {
274 !               screen_fill(row, row + 1, pum_col - pum_base_width - n + 1,
275 !                                                   col + 1, ' ', ' ', attr);
276 !               col = pum_col - pum_base_width - n + 1;
277 !           }
278 !           else
279 ! #endif
280 !           {
281 !               screen_fill(row, row + 1, col, pum_col + pum_base_width + n,
282                                                               ' ', ' ', attr);
283 !               col = pum_col + pum_base_width + n;
284 !           }
285             totwidth = pum_base_width + n;
286         }
287   
288 ! #ifdef FEAT_RIGHTLEFT
289 !       if (curwin->w_p_rl)
290 !           screen_fill(row, row + 1, pum_col - pum_width + 1, col + 1, ' ',
291 !                                                                   ' ', attr);
292 !       else
293 ! #endif
294 !           screen_fill(row, row + 1, col, pum_col + pum_width, ' ', ' ',
295 !                                                                       attr);
296         if (pum_scrollbar > 0)
297 !       {
298 ! #ifdef FEAT_RIGHTLEFT
299 !           if (curwin->w_p_rl)
300 !               screen_putchar(' ', row, pum_col - pum_width,
301 !                       i >= thumb_pos && i < thumb_pos + thumb_heigth
302                                                   ? attr_thumb : attr_scroll);
303 +           else
304 + #endif
305 +               screen_putchar(' ', row, pum_col + pum_width,
306 +                       i >= thumb_pos && i < thumb_pos + thumb_heigth
307 +                                                 ? attr_thumb : attr_scroll);
308 +       }
309   
310         ++row;
311       }
312 *** ../vim-7.1.057/src/proto/search.pro Sat May  5 20:20:36 2007
313 --- src/proto/search.pro        Wed Aug  1 12:41:25 2007
314 ***************
315 *** 1,6 ****
316 --- 1,7 ----
317   /* search.c */
318   int search_regcomp __ARGS((char_u *pat, int pat_save, int pat_use, int options, regmmatch_T *regmatch));
319   char_u *get_search_pat __ARGS((void));
320 + char_u *reverse_text __ARGS((char_u *s));
321   void save_search_patterns __ARGS((void));
322   void restore_search_patterns __ARGS((void));
323   void free_search_patterns __ARGS((void));
324 *** ../vim-7.1.057/src/search.c Tue Jul 10 13:27:46 2007
325 --- src/search.c        Wed Aug  1 12:39:22 2007
326 ***************
327 *** 101,107 ****
328   static char_u     *mr_pattern = NULL; /* pattern used by search_regcomp() */
329   #ifdef FEAT_RIGHTLEFT
330   static int        mr_pattern_alloced = FALSE; /* mr_pattern was allocated */
331 - static char_u     *reverse_text __ARGS((char_u *s));
332   #endif
333   
334   #ifdef FEAT_FIND_ID
335 --- 101,106 ----
336 ***************
337 *** 228,239 ****
338       return mr_pattern;
339   }
340   
341 ! #ifdef FEAT_RIGHTLEFT
342   /*
343    * Reverse text into allocated memory.
344    * Returns the allocated string, NULL when out of memory.
345    */
346 !     static char_u *
347   reverse_text(s)
348       char_u *s;
349   {
350 --- 227,238 ----
351       return mr_pattern;
352   }
353   
354 ! #if defined(FEAT_RIGHTLEFT) || defined(PROTO)
355   /*
356    * Reverse text into allocated memory.
357    * Returns the allocated string, NULL when out of memory.
358    */
359 !     char_u *
360   reverse_text(s)
361       char_u *s;
362   {
363 ***************
364 *** 1898,1904 ****
365       }
366   
367   #ifdef FEAT_RIGHTLEFT
368 !     /* This is just guessing: when 'rightleft' is set, search for a maching
369        * paren/brace in the other direction. */
370       if (curwin->w_p_rl && vim_strchr((char_u *)"()[]{}<>", initc) != NULL)
371         backwards = !backwards;
372 --- 1897,1903 ----
373       }
374   
375   #ifdef FEAT_RIGHTLEFT
376 !     /* This is just guessing: when 'rightleft' is set, search for a matching
377        * paren/brace in the other direction. */
378       if (curwin->w_p_rl && vim_strchr((char_u *)"()[]{}<>", initc) != NULL)
379         backwards = !backwards;
380 *** ../vim-7.1.057/src/version.c        Wed Aug  8 21:41:19 2007
381 --- src/version.c       Wed Aug  8 22:44:49 2007
382 ***************
383 *** 668,669 ****
384 --- 668,671 ----
385   {   /* Add new patch number below this line */
386 + /**/
387 +     58,
388   /**/
389
390 -- 
391 hundred-and-one symptoms of being an internet addict:
392 99. The hum of a cooling fan and the click of keys is comforting to you.
393
394  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
395 ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
396 \\\        download, build and distribute -- http://www.A-A-P.org        ///
397  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
This page took 3.067647 seconds and 3 git commands to generate.