home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / patches / 7.1 / 7.1.058 < prev    next >
Encoding:
Internet Message Format  |  2007-11-19  |  10.4 KB

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