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 / old / 5.6.054 < prev    next >
Encoding:
Internet Message Format  |  2000-04-03  |  6.7 KB

  1. To: vim-dev@vim.org
  2. Subject: Patch 5.6.054
  3. Fcc: outbox
  4. From: Bram Moolenaar <Bram@moolenaar.net>
  5. ------------
  6.  
  7. Patch 5.6.054
  8. Problem:    When using ":e" and ":e #" the cursor is put in the first column
  9.         when 'startofline' is set. (Cordell)
  10. Solution:   Use the last known column when 'startofline' is set.
  11.         Also, use ECMD_LAST more often to simplify the code.
  12. Files:        src/buffer.c, src/ex_cmds.c, src/ex_docmd.c, src/proto/buffer.pro
  13.  
  14.  
  15. *** ../vim-5.6.53/src/buffer.c    Wed Jan 26 12:20:20 2000
  16. --- src/buffer.c    Tue Apr  4 16:28:34 2000
  17. ***************
  18. *** 30,36 ****
  19.   static char_u    *buflist_match __ARGS((vim_regexp *prog, BUF *buf));
  20.   static char_u    *buflist_match_try __ARGS((vim_regexp *prog, char_u *name));
  21.   static void    buflist_setfpos __ARGS((BUF *, linenr_t, colnr_t));
  22. - static FPOS    *buflist_findfpos __ARGS((BUF *buf));
  23.   #ifdef UNIX
  24.   static int    otherfile_buf __ARGS((BUF *buf, char_u *ffname, struct stat *stp));
  25.   static void    buf_setino __ARGS((BUF *buf));
  26. --- 30,35 ----
  27. ***************
  28. *** 1423,1429 ****
  29.    * find the position (lnum and col) for the buffer 'buf' for the current window
  30.    * returns a pointer to no_position if no position is found
  31.    */
  32. !     static FPOS *
  33.   buflist_findfpos(buf)
  34.       BUF        *buf;
  35.   {
  36. --- 1422,1428 ----
  37.    * find the position (lnum and col) for the buffer 'buf' for the current window
  38.    * returns a pointer to no_position if no position is found
  39.    */
  40. !     FPOS *
  41.   buflist_findfpos(buf)
  42.       BUF        *buf;
  43.   {
  44. *** ../vim-5.6.53/src/ex_cmds.c    Thu Mar 30 16:44:47 2000
  45. --- src/ex_cmds.c    Tue Apr  4 16:25:26 2000
  46. ***************
  47. *** 2294,2299 ****
  48. --- 2294,2301 ----
  49.       linenr_t    lnum;
  50.       linenr_t    topline = 0;
  51.       int        newcol = -1;
  52. +     int        solcol = -1;
  53. +     FPOS    *pos;
  54.   
  55.       if (fnum != 0)
  56.       {
  57. ***************
  58. *** 2417,2423 ****
  59.       /* May jump to last used line number for a loaded buffer or when asked
  60.        * for explicitly */
  61.       if ((oldbuf && newlnum == ECMD_LASTL) || newlnum == ECMD_LAST)
  62. !         newlnum = buflist_findlnum(buf);
  63.   
  64.       /*
  65.        * Make the (new) buffer the one used by the current window.
  66. --- 2419,2429 ----
  67.       /* May jump to last used line number for a loaded buffer or when asked
  68.        * for explicitly */
  69.       if ((oldbuf && newlnum == ECMD_LASTL) || newlnum == ECMD_LAST)
  70. !     {
  71. !         pos = buflist_findfpos(buf);
  72. !         newlnum = pos->lnum;
  73. !         solcol = pos->col;
  74. !     }
  75.   
  76.       /*
  77.        * Make the (new) buffer the one used by the current window.
  78. ***************
  79. *** 2514,2520 ****
  80. --- 2520,2529 ----
  81.       {
  82.       set_last_cursor(curwin);    /* may set b_last_cursor */
  83.       if (newlnum == ECMD_LAST || newlnum == ECMD_LASTL)
  84. +     {
  85.           newlnum = curwin->w_cursor.lnum;
  86. +         solcol = curwin->w_cursor.col;
  87. +     }
  88.   #ifdef AUTOCMD
  89.       buf = curbuf;
  90.       if (buf->b_fname != NULL)
  91. ***************
  92. *** 2651,2657 ****
  93.       {
  94.           curwin->w_cursor.lnum = newlnum;
  95.           check_cursor_lnum();
  96. !         beginline(BL_SOL | BL_FIX);
  97.       }
  98.       else            /* no line number, go to last line in Ex mode */
  99.       {
  100. --- 2660,2673 ----
  101.       {
  102.           curwin->w_cursor.lnum = newlnum;
  103.           check_cursor_lnum();
  104. !         if (solcol >= 0 && !p_sol)
  105. !         {
  106. !         /* 'sol' is off: Use last known column. */
  107. !         curwin->w_cursor.col = solcol;
  108. !         check_cursor_col();
  109. !         }
  110. !         else
  111. !         beginline(BL_SOL | BL_FIX);
  112.       }
  113.       else            /* no line number, go to last line in Ex mode */
  114.       {
  115. *** ../vim-5.6.53/src/ex_docmd.c    Mon Apr  3 09:38:10 2000
  116. --- src/ex_docmd.c    Tue Apr  4 16:52:08 2000
  117. ***************
  118. *** 5848,5855 ****
  119.   {
  120.       int        other;
  121.       char_u    *p;
  122. -     char_u    *ffname;
  123. -     BUF        *buf;
  124.   
  125.       if (argn < 0 || argn >= arg_file_count)
  126.       {
  127. --- 5851,5856 ----
  128. ***************
  129. *** 5894,5916 ****
  130.       if (argn == arg_file_count - 1)
  131.           arg_had_last = TRUE;
  132.   
  133. !     /*
  134. !      * If no line number given, use the last known line number.
  135. !      */
  136. !     if (eap->do_ecmd_lnum == 0)
  137. !     {
  138. !         ffname = fix_fname(arg_files[curwin->w_arg_idx]);
  139. !         if (ffname != NULL)
  140. !         {
  141. !         buf = buflist_findname(ffname);
  142. !         if (buf != NULL)
  143. !             eap->do_ecmd_lnum = buflist_findlnum(buf);
  144. !         vim_free(ffname);
  145. !         }
  146. !     }
  147.       (void)do_ecmd(0, arg_files[curwin->w_arg_idx],
  148. !               NULL, eap->do_ecmd_cmd, eap->do_ecmd_lnum,
  149.                 (p_hid ? ECMD_HIDE : 0) +
  150.                          (eap->forceit ? ECMD_FORCEIT : 0));
  151.       }
  152. --- 5895,5903 ----
  153.       if (argn == arg_file_count - 1)
  154.           arg_had_last = TRUE;
  155.   
  156. !     /* Edit the file; always use the last known line number. */
  157.       (void)do_ecmd(0, arg_files[curwin->w_arg_idx],
  158. !               NULL, eap->do_ecmd_cmd, ECMD_LAST,
  159.                 (p_hid ? ECMD_HIDE : 0) +
  160.                          (eap->forceit ? ECMD_FORCEIT : 0));
  161.       }
  162. ***************
  163. *** 7534,7540 ****
  164.               return NULL;
  165.           }
  166.           if (lnump != NULL)
  167. !             *lnump = buflist_findlnum(buf);
  168.           if (buf->b_fname == NULL)
  169.           {
  170.               result = (char_u *)"";
  171. --- 7521,7527 ----
  172.               return NULL;
  173.           }
  174.           if (lnump != NULL)
  175. !             *lnump = ECMD_LAST;
  176.           if (buf->b_fname == NULL)
  177.           {
  178.               result = (char_u *)"";
  179. ***************
  180. *** 7652,7658 ****
  181.       char_u    *repl;
  182.       int        srclen;
  183.       char_u    *p;
  184. -     linenr_t    dummy;
  185.   
  186.       result = vim_strsave(arg);
  187.       if (result == NULL)
  188. --- 7639,7644 ----
  189. ***************
  190. *** 7665,7671 ****
  191.       else
  192.       {
  193.           /* replace "<sfile>" with the sourced file name, and do ":" stuff */
  194. !         repl = eval_vars(p, &srclen, &dummy, &errormsg, result);
  195.           if (errormsg != NULL)
  196.           {
  197.           if (*errormsg)
  198. --- 7651,7657 ----
  199.       else
  200.       {
  201.           /* replace "<sfile>" with the sourced file name, and do ":" stuff */
  202. !         repl = eval_vars(p, &srclen, NULL, &errormsg, result);
  203.           if (errormsg != NULL)
  204.           {
  205.           if (*errormsg)
  206. *** ../vim-5.6.53/src/proto/buffer.pro    Sun Jan 16 14:22:13 2000
  207. --- src/proto/buffer.pro    Tue Apr  4 16:27:04 2000
  208. ***************
  209. *** 16,21 ****
  210. --- 16,22 ----
  211.   int ExpandBufnames __ARGS((char_u *pat, int *num_file, char_u ***file, int options));
  212.   BUF *buflist_findnr __ARGS((int nr));
  213.   char_u *buflist_nr2name __ARGS((int n, int fullname, int helptail));
  214. + FPOS *buflist_findfpos __ARGS((BUF *buf));
  215.   linenr_t buflist_findlnum __ARGS((BUF *buf));
  216.   void buflist_list __ARGS((void));
  217.   int buflist_name_nr __ARGS((int fnum, char_u **fname, linenr_t *lnum));
  218. *** ../vim-5.6.53/src/version.c    Mon Apr  3 21:11:14 2000
  219. --- src/version.c    Tue Apr  4 17:06:54 2000
  220. ***************
  221. *** 420,421 ****
  222. --- 420,423 ----
  223.   {   /* Add new patch number below this line */
  224. + /**/
  225. +     54,
  226.   /**/
  227.  
  228. -- 
  229. INSPECTOR END OF FILM: Move along.  There's nothing to see!  Keep moving!
  230.    [Suddenly he notices the cameras.]
  231. INSPECTOR END OF FILM: (to Camera) All right, put that away sonny.
  232.    [He walks over to it and puts his hand over the lens.]
  233.                  "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
  234.  
  235. /-/-- Bram Moolenaar --- Bram@moolenaar.net --- http://www.moolenaar.net --\-\
  236. \-\-- Vim: http://www.vim.org ---- ICCF Holland: http://www.vim.org/iccf --/-/
  237.