• R/O
  • SSH

vim: Commit

Mirror of the Vim source from https://github.com/vim/vim


Commit MetaInfo

Revisão843bfffb04c739ec456e5c5f612c6d025f2a6188 (tree)
Hora2007-08-09 05:49:37
Autorvimboss
Commitervimboss

Mensagem de Log

updated for version 7.1-058

Mudança Sumário

Diff

diff -r 4dccbe792a5e -r 843bfffb04c7 src/popupmnu.c
--- a/src/popupmnu.c Wed Aug 08 19:42:05 2007 +0000
+++ b/src/popupmnu.c Wed Aug 08 20:49:37 2007 +0000
@@ -75,7 +75,6 @@
7575
7676 row = curwin->w_cline_row + W_WINROW(curwin);
7777 height = curwin->w_cline_height;
78- col = curwin->w_wcol + W_WINCOL(curwin) - curwin->w_leftcol;
7978
8079 if (firstwin->w_p_pvw)
8180 top_clear = firstwin->w_height;
@@ -167,6 +166,15 @@
167166 pum_base_width = max_width;
168167 pum_kind_width = kind_width;
169168
169+ /* Calculate column */
170+#ifdef FEAT_RIGHTLEFT
171+ if (curwin->w_p_rl)
172+ col = W_WINCOL(curwin) + W_WIDTH(curwin) - curwin->w_wcol -
173+ curwin->w_leftcol - 1;
174+ else
175+#endif
176+ col = W_WINCOL(curwin) + curwin->w_wcol - curwin->w_leftcol;
177+
170178 /* if there are more items than room we need a scrollbar */
171179 if (pum_height < size)
172180 {
@@ -179,11 +187,23 @@
179187 if (def_width < max_width)
180188 def_width = max_width;
181189
182- if (col < Columns - PUM_DEF_WIDTH || col < Columns - max_width)
190+ if (((col < Columns - PUM_DEF_WIDTH || col < Columns - max_width)
191+#ifdef FEAT_RIGHTLEFT
192+ && !curwin->w_p_rl)
193+ || (curwin->w_p_rl && (col > PUM_DEF_WIDTH || col > max_width)
194+#endif
195+ ))
183196 {
184197 /* align pum column with "col" */
185198 pum_col = col;
186- pum_width = Columns - pum_col - pum_scrollbar;
199+
200+#ifdef FEAT_RIGHTLEFT
201+ if (curwin->w_p_rl)
202+ pum_width = pum_col - pum_scrollbar + 1;
203+ else
204+#endif
205+ pum_width = Columns - pum_col - pum_scrollbar;
206+
187207 if (pum_width > max_width + kind_width + extra_width + 1
188208 && pum_width > PUM_DEF_WIDTH)
189209 {
@@ -195,14 +215,24 @@
195215 else if (Columns < def_width)
196216 {
197217 /* not enough room, will use what we have */
198- pum_col = 0;
218+#ifdef FEAT_RIGHTLEFT
219+ if (curwin->w_p_rl)
220+ pum_col = Columns - 1;
221+ else
222+#endif
223+ pum_col = 0;
199224 pum_width = Columns - 1;
200225 }
201226 else
202227 {
203228 if (max_width > PUM_DEF_WIDTH)
204229 max_width = PUM_DEF_WIDTH; /* truncate */
205- pum_col = Columns - max_width;
230+#ifdef FEAT_RIGHTLEFT
231+ if (curwin->w_p_rl)
232+ pum_col = max_width - 1;
233+ else
234+#endif
235+ pum_col = Columns - max_width;
206236 pum_width = max_width - pum_scrollbar;
207237 }
208238
@@ -255,8 +285,16 @@
255285 attr = (idx == pum_selected) ? attr_select : attr_norm;
256286
257287 /* prepend a space if there is room */
258- if (pum_col > 0)
259- screen_putchar(' ', row, pum_col - 1, attr);
288+#ifdef FEAT_RIGHTLEFT
289+ if (curwin->w_p_rl)
290+ {
291+ if (pum_col < W_WINCOL(curwin) + W_WIDTH(curwin) - 1)
292+ screen_putchar(' ', row, pum_col + 1, attr);
293+ }
294+ else
295+#endif
296+ if (pum_col > 0)
297+ screen_putchar(' ', row, pum_col - 1, attr);
260298
261299 /* Display each entry, use two spaces for a Tab.
262300 * Do this 3 times: For the main text, kind and extra info */
@@ -282,26 +320,67 @@
282320 {
283321 /* Display the text that fits or comes before a Tab.
284322 * First convert it to printable characters. */
285- char_u *st;
286- int saved = *p;
323+ char_u *st;
324+ int saved = *p;
287325
288326 *p = NUL;
289327 st = transstr(s);
290328 *p = saved;
291- if (st != NULL)
329+#ifdef FEAT_RIGHTLEFT
330+ if (curwin->w_p_rl)
292331 {
293- screen_puts_len(st, (int)STRLEN(st), row, col,
332+ if (st != NULL)
333+ {
334+ char_u *rt = reverse_text(st);
335+ char_u *rt_saved = rt;
336+ int len, j;
337+
338+ if (rt != NULL)
339+ {
340+ len = STRLEN(rt);
341+ if (len > pum_width)
342+ {
343+ for (j = pum_width; j < len; ++j)
344+ mb_ptr_adv(rt);
345+ len = pum_width;
346+ }
347+ screen_puts_len(rt, len, row,
348+ col - len + 1, attr);
349+ vim_free(rt_saved);
350+ }
351+ vim_free(st);
352+ }
353+ col -= width;
354+ }
355+ else
356+#endif
357+ {
358+ if (st != NULL)
359+ {
360+ screen_puts_len(st, (int)STRLEN(st), row, col,
294361 attr);
295- vim_free(st);
362+ vim_free(st);
363+ }
364+ col += width;
296365 }
297- col += width;
298366
299367 if (*p != TAB)
300368 break;
301369
302370 /* Display two spaces for a Tab. */
303- screen_puts_len((char_u *)" ", 2, row, col, attr);
304- col += 2;
371+#ifdef FEAT_RIGHTLEFT
372+ if (curwin->w_p_rl)
373+ {
374+ screen_puts_len((char_u *)" ", 2, row, col - 1,
375+ attr);
376+ col -= 2;
377+ }
378+ else
379+#endif
380+ {
381+ screen_puts_len((char_u *)" ", 2, row, col, attr);
382+ col += 2;
383+ }
305384 totwidth += 2;
306385 s = NULL; /* start text at next char */
307386 width = 0;
@@ -322,17 +401,44 @@
322401 && pum_array[idx].pum_extra == NULL)
323402 || pum_base_width + n >= pum_width)
324403 break;
325- screen_fill(row, row + 1, col, pum_col + pum_base_width + n,
404+#ifdef FEAT_RIGHTLEFT
405+ if (curwin->w_p_rl)
406+ {
407+ screen_fill(row, row + 1, pum_col - pum_base_width - n + 1,
408+ col + 1, ' ', ' ', attr);
409+ col = pum_col - pum_base_width - n + 1;
410+ }
411+ else
412+#endif
413+ {
414+ screen_fill(row, row + 1, col, pum_col + pum_base_width + n,
326415 ' ', ' ', attr);
327- col = pum_col + pum_base_width + n;
416+ col = pum_col + pum_base_width + n;
417+ }
328418 totwidth = pum_base_width + n;
329419 }
330420
331- screen_fill(row, row + 1, col, pum_col + pum_width, ' ', ' ', attr);
421+#ifdef FEAT_RIGHTLEFT
422+ if (curwin->w_p_rl)
423+ screen_fill(row, row + 1, pum_col - pum_width + 1, col + 1, ' ',
424+ ' ', attr);
425+ else
426+#endif
427+ screen_fill(row, row + 1, col, pum_col + pum_width, ' ', ' ',
428+ attr);
332429 if (pum_scrollbar > 0)
333- screen_putchar(' ', row, pum_col + pum_width,
334- i >= thumb_pos && i < thumb_pos + thumb_heigth
430+ {
431+#ifdef FEAT_RIGHTLEFT
432+ if (curwin->w_p_rl)
433+ screen_putchar(' ', row, pum_col - pum_width,
434+ i >= thumb_pos && i < thumb_pos + thumb_heigth
335435 ? attr_thumb : attr_scroll);
436+ else
437+#endif
438+ screen_putchar(' ', row, pum_col + pum_width,
439+ i >= thumb_pos && i < thumb_pos + thumb_heigth
440+ ? attr_thumb : attr_scroll);
441+ }
336442
337443 ++row;
338444 }
diff -r 4dccbe792a5e -r 843bfffb04c7 src/proto/search.pro
--- a/src/proto/search.pro Wed Aug 08 19:42:05 2007 +0000
+++ b/src/proto/search.pro Wed Aug 08 20:49:37 2007 +0000
@@ -1,6 +1,7 @@
11 /* search.c */
22 int search_regcomp __ARGS((char_u *pat, int pat_save, int pat_use, int options, regmmatch_T *regmatch));
33 char_u *get_search_pat __ARGS((void));
4+char_u *reverse_text __ARGS((char_u *s));
45 void save_search_patterns __ARGS((void));
56 void restore_search_patterns __ARGS((void));
67 void free_search_patterns __ARGS((void));
diff -r 4dccbe792a5e -r 843bfffb04c7 src/search.c
--- a/src/search.c Wed Aug 08 19:42:05 2007 +0000
+++ b/src/search.c Wed Aug 08 20:49:37 2007 +0000
@@ -101,7 +101,6 @@
101101 static char_u *mr_pattern = NULL; /* pattern used by search_regcomp() */
102102 #ifdef FEAT_RIGHTLEFT
103103 static int mr_pattern_alloced = FALSE; /* mr_pattern was allocated */
104-static char_u *reverse_text __ARGS((char_u *s));
105104 #endif
106105
107106 #ifdef FEAT_FIND_ID
@@ -228,12 +227,12 @@
228227 return mr_pattern;
229228 }
230229
231-#ifdef FEAT_RIGHTLEFT
230+#if defined(FEAT_RIGHTLEFT) || defined(PROTO)
232231 /*
233232 * Reverse text into allocated memory.
234233 * Returns the allocated string, NULL when out of memory.
235234 */
236- static char_u *
235+ char_u *
237236 reverse_text(s)
238237 char_u *s;
239238 {
@@ -1898,7 +1897,7 @@
18981897 }
18991898
19001899 #ifdef FEAT_RIGHTLEFT
1901- /* This is just guessing: when 'rightleft' is set, search for a maching
1900+ /* This is just guessing: when 'rightleft' is set, search for a matching
19021901 * paren/brace in the other direction. */
19031902 if (curwin->w_p_rl && vim_strchr((char_u *)"()[]{}<>", initc) != NULL)
19041903 backwards = !backwards;
diff -r 4dccbe792a5e -r 843bfffb04c7 src/version.c
--- a/src/version.c Wed Aug 08 19:42:05 2007 +0000
+++ b/src/version.c Wed Aug 08 20:49:37 2007 +0000
@@ -667,6 +667,8 @@
667667 static int included_patches[] =
668668 { /* Add new patch number below this line */
669669 /**/
670+ 58,
671+/**/
670672 57,
671673 /**/
672674 56,
Show on old repository browser