4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=ISO-8859-1
7 Content-Transfer-Encoding: 8bit
11 Problem: When 'rightleft' is set the completion menu is positioned wrong.
13 Solution: Fix the completion menu. (Martin Toft)
14 Files: src/popupmnu.c, src/proto/search.pro, src/search.c
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
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;
26 if (firstwin->w_p_pvw)
27 top_clear = firstwin->w_height;
32 pum_base_width = max_width;
33 pum_kind_width = kind_width;
35 + /* Calculate column */
36 + #ifdef FEAT_RIGHTLEFT
38 + col = W_WINCOL(curwin) + W_WIDTH(curwin) - curwin->w_wcol -
39 + curwin->w_leftcol - 1;
42 + col = W_WINCOL(curwin) + curwin->w_wcol - curwin->w_leftcol;
44 /* if there are more items than room we need a scrollbar */
45 if (pum_height < size)
49 if (def_width < max_width)
50 def_width = max_width;
52 ! if (col < Columns - PUM_DEF_WIDTH || col < Columns - max_width)
54 /* align pum column with "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)
61 if (def_width < max_width)
62 def_width = max_width;
64 ! if (((col < Columns - PUM_DEF_WIDTH || col < Columns - max_width)
65 ! #ifdef FEAT_RIGHTLEFT
67 ! || (curwin->w_p_rl && (col > PUM_DEF_WIDTH || col > max_width)
71 /* align pum column with "col" */
74 ! #ifdef FEAT_RIGHTLEFT
76 ! pum_width = pum_col - pum_scrollbar + 1;
79 ! pum_width = Columns - pum_col - pum_scrollbar;
81 if (pum_width > max_width + kind_width + extra_width + 1
82 && pum_width > PUM_DEF_WIDTH)
86 else if (Columns < def_width)
88 /* not enough room, will use what we have */
90 pum_width = Columns - 1;
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;
101 else if (Columns < def_width)
103 /* not enough room, will use what we have */
104 ! #ifdef FEAT_RIGHTLEFT
105 ! if (curwin->w_p_rl)
106 ! pum_col = Columns - 1;
110 pum_width = Columns - 1;
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;
121 ! pum_col = Columns - max_width;
122 pum_width = max_width - pum_scrollbar;
127 attr = (idx == pum_selected) ? attr_select : attr_norm;
129 /* prepend a space if there is room */
131 ! screen_putchar(' ', row, pum_col - 1, attr);
133 /* Display each entry, use two spaces for a Tab.
134 * Do this 3 times: For the main text, kind and extra info */
136 attr = (idx == pum_selected) ? attr_select : attr_norm;
138 /* prepend a space if there is room */
139 ! #ifdef FEAT_RIGHTLEFT
140 ! if (curwin->w_p_rl)
142 ! if (pum_col < W_WINCOL(curwin) + W_WIDTH(curwin) - 1)
143 ! screen_putchar(' ', row, pum_col + 1, attr);
148 ! screen_putchar(' ', row, pum_col - 1, attr);
150 /* Display each entry, use two spaces for a Tab.
151 * Do this 3 times: For the main text, kind and extra info */
155 /* Display the text that fits or comes before a Tab.
156 * First convert it to printable characters. */
165 ! screen_puts_len(st, (int)STRLEN(st), row, col,
174 /* Display two spaces for a Tab. */
175 ! screen_puts_len((char_u *)" ", 2, row, col, attr);
178 s = NULL; /* start text at next char */
182 /* Display the text that fits or comes before a Tab.
183 * First convert it to printable characters. */
190 ! #ifdef FEAT_RIGHTLEFT
191 ! if (curwin->w_p_rl)
195 ! char_u *rt = reverse_text(st);
196 ! char_u *rt_saved = rt;
202 ! if (len > pum_width)
204 ! for (j = pum_width; j < len; ++j)
208 ! screen_puts_len(rt, len, row,
209 ! col - len + 1, attr);
210 ! vim_free(rt_saved);
221 ! screen_puts_len(st, (int)STRLEN(st), row, col,
231 /* Display two spaces for a Tab. */
232 ! #ifdef FEAT_RIGHTLEFT
233 ! if (curwin->w_p_rl)
235 ! screen_puts_len((char_u *)" ", 2, row, col - 1,
242 ! screen_puts_len((char_u *)" ", 2, row, col, attr);
246 s = NULL; /* start text at next char */
250 && pum_array[idx].pum_extra == NULL)
251 || pum_base_width + n >= pum_width)
253 ! screen_fill(row, row + 1, col, pum_col + pum_base_width + n,
255 ! col = pum_col + pum_base_width + n;
256 totwidth = pum_base_width + n;
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);
268 && pum_array[idx].pum_extra == NULL)
269 || pum_base_width + n >= pum_width)
271 ! #ifdef FEAT_RIGHTLEFT
272 ! if (curwin->w_p_rl)
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;
281 ! screen_fill(row, row + 1, col, pum_col + pum_base_width + n,
283 ! col = pum_col + pum_base_width + n;
285 totwidth = pum_base_width + n;
288 ! #ifdef FEAT_RIGHTLEFT
289 ! if (curwin->w_p_rl)
290 ! screen_fill(row, row + 1, pum_col - pum_width + 1, col + 1, ' ',
294 ! screen_fill(row, row + 1, col, pum_col + pum_width, ' ', ' ',
296 if (pum_scrollbar > 0)
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);
305 + screen_putchar(' ', row, pum_col + pum_width,
306 + i >= thumb_pos && i < thumb_pos + thumb_heigth
307 + ? attr_thumb : attr_scroll);
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
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
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));
341 ! #ifdef FEAT_RIGHTLEFT
343 * Reverse text into allocated memory.
344 * Returns the allocated string, NULL when out of memory.
354 ! #if defined(FEAT_RIGHTLEFT) || defined(PROTO)
356 * Reverse text into allocated memory.
357 * Returns the allocated string, NULL when out of memory.
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;
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
385 { /* Add new patch number below this line */
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.
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 ///