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.3 / 7.3.892 < prev    next >
Encoding:
Internet Message Format  |  2013-04-13  |  7.8 KB

  1. To: vim_dev@googlegroups.com
  2. Subject: Patch 7.3.892
  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.892 (after 7.3.891)
  11. Problem:    Still merging problems for viminfo history.
  12. Solution:   Do not merge lines when writing, don't write old viminfo lines.
  13. Files:        src/ex_getln.c, src/ex_cmds.c, src/proto/ex_getln.pro
  14.  
  15.  
  16. *** ../vim-7.3.891/src/ex_getln.c    2013-04-14 16:26:08.000000000 +0200
  17. --- src/ex_getln.c    2013-04-14 23:12:37.000000000 +0200
  18. ***************
  19. *** 68,74 ****
  20.   
  21.   static int    hist_char2type __ARGS((int c));
  22.   
  23. ! static int    in_history __ARGS((int, char_u *, int, int));
  24.   # ifdef FEAT_EVAL
  25.   static int    calc_hist_idx __ARGS((int histype, int num));
  26.   # endif
  27. --- 68,74 ----
  28.   
  29.   static int    hist_char2type __ARGS((int c));
  30.   
  31. ! static int    in_history __ARGS((int, char_u *, int, int, int));
  32.   # ifdef FEAT_EVAL
  33.   static int    calc_hist_idx __ARGS((int histype, int num));
  34.   # endif
  35. ***************
  36. *** 5397,5407 ****
  37.    * If 'move_to_front' is TRUE, matching entry is moved to end of history.
  38.    */
  39.       static int
  40. ! in_history(type, str, move_to_front, sep)
  41.       int        type;
  42.       char_u  *str;
  43.       int        move_to_front;    /* Move the entry to the front if it exists */
  44.       int        sep;
  45.   {
  46.       int        i;
  47.       int        last_i = -1;
  48. --- 5397,5408 ----
  49.    * If 'move_to_front' is TRUE, matching entry is moved to end of history.
  50.    */
  51.       static int
  52. ! in_history(type, str, move_to_front, sep, writing)
  53.       int        type;
  54.       char_u  *str;
  55.       int        move_to_front;    /* Move the entry to the front if it exists */
  56.       int        sep;
  57. +     int        writing;        /* ignore entries read from viminfo */
  58.   {
  59.       int        i;
  60.       int        last_i = -1;
  61. ***************
  62. *** 5419,5424 ****
  63. --- 5420,5426 ----
  64.        * well. */
  65.       p = history[type][i].hisstr;
  66.       if (STRCMP(str, p) == 0
  67. +         && !(writing && history[type][i].viminfo)
  68.           && (type != HIST_SEARCH || sep == p[STRLEN(p) + 1]))
  69.       {
  70.           if (!move_to_front)
  71. ***************
  72. *** 5513,5519 ****
  73.       }
  74.       last_maptick = -1;
  75.       }
  76. !     if (!in_history(histype, new_entry, TRUE, sep))
  77.       {
  78.       if (++hisidx[histype] == hislen)
  79.           hisidx[histype] = 0;
  80. --- 5515,5521 ----
  81.       }
  82.       last_maptick = -1;
  83.       }
  84. !     if (!in_history(histype, new_entry, TRUE, sep, FALSE))
  85.       {
  86.       if (++hisidx[histype] == hislen)
  87.           hisidx[histype] = 0;
  88. ***************
  89. *** 6032,6039 ****
  90.    * This allocates history arrays to store the read history lines.
  91.    */
  92.       void
  93. ! prepare_viminfo_history(asklen)
  94.       int        asklen;
  95.   {
  96.       int        i;
  97.       int        num;
  98. --- 6034,6042 ----
  99.    * This allocates history arrays to store the read history lines.
  100.    */
  101.       void
  102. ! prepare_viminfo_history(asklen, writing)
  103.       int        asklen;
  104. +     int        writing;
  105.   {
  106.       int        i;
  107.       int        num;
  108. ***************
  109. *** 6041,6047 ****
  110.       int        len;
  111.   
  112.       init_history();
  113. !     viminfo_add_at_front = (asklen != 0);
  114.       if (asklen > hislen)
  115.       asklen = hislen;
  116.   
  117. --- 6044,6050 ----
  118.       int        len;
  119.   
  120.       init_history();
  121. !     viminfo_add_at_front = (asklen != 0 && !writing);
  122.       if (asklen > hislen)
  123.       asklen = hislen;
  124.   
  125. ***************
  126. *** 6073,6080 ****
  127.    * new.
  128.    */
  129.       int
  130. ! read_viminfo_history(virp)
  131.       vir_T    *virp;
  132.   {
  133.       int        type;
  134.       long_u    len;
  135. --- 6076,6084 ----
  136.    * new.
  137.    */
  138.       int
  139. ! read_viminfo_history(virp, writing)
  140.       vir_T    *virp;
  141. +     int        writing;
  142.   {
  143.       int        type;
  144.       long_u    len;
  145. ***************
  146. *** 6090,6096 ****
  147.           int sep = (*val == ' ' ? NUL : *val);
  148.   
  149.           if (!in_history(type, val + (type == HIST_SEARCH),
  150. !                            viminfo_add_at_front, sep))
  151.           {
  152.           /* Need to re-allocate to append the separator byte. */
  153.           len = STRLEN(val);
  154. --- 6094,6100 ----
  155.           int sep = (*val == ' ' ? NUL : *val);
  156.   
  157.           if (!in_history(type, val + (type == HIST_SEARCH),
  158. !                       viminfo_add_at_front, sep, writing))
  159.           {
  160.           /* Need to re-allocate to append the separator byte. */
  161.           len = STRLEN(val);
  162. ***************
  163. *** 6120,6125 ****
  164. --- 6124,6132 ----
  165.       return viminfo_readline(virp);
  166.   }
  167.   
  168. + /*
  169. +  * Finish reading history lines from viminfo.  Not used when writing viminfo.
  170. +  */
  171.       void
  172.   finish_viminfo_history()
  173.   {
  174. ***************
  175. *** 6216,6222 ****
  176.           {
  177.               p = round == 1 ? history[type][i].hisstr
  178.                              : viminfo_history[type][i];
  179. !             if (p != NULL)
  180.               {
  181.               --num_saved;
  182.               fputc(hist_type2char(type, TRUE), fp);
  183. --- 6223,6229 ----
  184.           {
  185.               p = round == 1 ? history[type][i].hisstr
  186.                              : viminfo_history[type][i];
  187. !             if (p != NULL && (round == 2 || !history[type][i].viminfo))
  188.               {
  189.               --num_saved;
  190.               fputc(hist_type2char(type, TRUE), fp);
  191. ***************
  192. *** 6245,6250 ****
  193. --- 6252,6261 ----
  194.               }
  195.           }
  196.       }
  197. +     for (i = 0; i < viminfo_hisidx[type]; ++i)
  198. +         vim_free(viminfo_history[type][i]);
  199. +     vim_free(viminfo_history[type]);
  200. +     viminfo_history[type] = NULL;
  201.       }
  202.   }
  203.   #endif /* FEAT_VIMINFO */
  204. *** ../vim-7.3.891/src/ex_cmds.c    2013-03-07 16:41:26.000000000 +0100
  205. --- src/ex_cmds.c    2013-04-14 23:08:26.000000000 +0200
  206. ***************
  207. *** 2113,2119 ****
  208.       buf_T    *buf;
  209.   
  210.   #ifdef FEAT_CMDHIST
  211. !     prepare_viminfo_history(forceit ? 9999 : 0);
  212.   #endif
  213.       eof = viminfo_readline(virp);
  214.       while (!eof && virp->vir_line[0] != '>')
  215. --- 2113,2119 ----
  216.       buf_T    *buf;
  217.   
  218.   #ifdef FEAT_CMDHIST
  219. !     prepare_viminfo_history(forceit ? 9999 : 0, writing);
  220.   #endif
  221.       eof = viminfo_readline(virp);
  222.       while (!eof && virp->vir_line[0] != '>')
  223. ***************
  224. *** 2161,2167 ****
  225.           case '=':
  226.           case '@':
  227.   #ifdef FEAT_CMDHIST
  228. !         eof = read_viminfo_history(virp);
  229.   #else
  230.           eof = viminfo_readline(virp);
  231.   #endif
  232. --- 2161,2167 ----
  233.           case '=':
  234.           case '@':
  235.   #ifdef FEAT_CMDHIST
  236. !         eof = read_viminfo_history(virp, writing);
  237.   #else
  238.           eof = viminfo_readline(virp);
  239.   #endif
  240. ***************
  241. *** 2182,2188 ****
  242.   
  243.   #ifdef FEAT_CMDHIST
  244.       /* Finish reading history items. */
  245. !     finish_viminfo_history();
  246.   #endif
  247.   
  248.       /* Change file names to buffer numbers for fmarks. */
  249. --- 2182,2189 ----
  250.   
  251.   #ifdef FEAT_CMDHIST
  252.       /* Finish reading history items. */
  253. !     if (!writing)
  254. !     finish_viminfo_history();
  255.   #endif
  256.   
  257.       /* Change file names to buffer numbers for fmarks. */
  258. *** ../vim-7.3.891/src/proto/ex_getln.pro    2011-05-19 18:26:34.000000000 +0200
  259. --- src/proto/ex_getln.pro    2013-04-14 23:12:02.000000000 +0200
  260. ***************
  261. *** 48,55 ****
  262.   void remove_key_from_history __ARGS((void));
  263.   int get_list_range __ARGS((char_u **str, int *num1, int *num2));
  264.   void ex_history __ARGS((exarg_T *eap));
  265. ! void prepare_viminfo_history __ARGS((int asklen));
  266. ! int read_viminfo_history __ARGS((vir_T *virp));
  267.   void finish_viminfo_history __ARGS((void));
  268.   void write_viminfo_history __ARGS((FILE *fp));
  269.   void cmd_pchar __ARGS((int c, int offset));
  270. --- 48,55 ----
  271.   void remove_key_from_history __ARGS((void));
  272.   int get_list_range __ARGS((char_u **str, int *num1, int *num2));
  273.   void ex_history __ARGS((exarg_T *eap));
  274. ! void prepare_viminfo_history __ARGS((int asklen, int writing));
  275. ! int read_viminfo_history __ARGS((vir_T *virp, int writing));
  276.   void finish_viminfo_history __ARGS((void));
  277.   void write_viminfo_history __ARGS((FILE *fp));
  278.   void cmd_pchar __ARGS((int c, int offset));
  279. *** ../vim-7.3.891/src/version.c    2013-04-14 16:26:08.000000000 +0200
  280. --- src/version.c    2013-04-14 22:53:04.000000000 +0200
  281. ***************
  282. *** 730,731 ****
  283. --- 730,733 ----
  284.   {   /* Add new patch number below this line */
  285. + /**/
  286. +     892,
  287.   /**/
  288.  
  289. -- 
  290. "Hit any key to continue" is a lie.
  291.  
  292.  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
  293. ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
  294. \\\  an exciting new programming language -- http://www.Zimbu.org        ///
  295.  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
  296.