[BACK]Return to window.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / vim

Diff for /src/usr.bin/vim/Attic/window.c between version 1.1 and 1.2

version 1.1, 1996/09/07 21:40:24 version 1.2, 1996/09/21 06:23:27
Line 238 
Line 238 
                                 {                                  {
                                         setpcmark();                                          setpcmark();
                                         if (win_split(0, FALSE) == OK)                                          if (win_split(0, FALSE) == OK)
                                                 (void)do_ecmd(0, ptr, NULL, NULL, p_hid, (linenr_t)0, FALSE);                                                  (void)do_ecmd(0, ptr, NULL, NULL, (linenr_t)0,
                                                                                                              p_hid ? ECMD_HIDE : 0);
                                         vim_free(ptr);                                          vim_free(ptr);
                                 }                                  }
                                 break;                                  break;
Line 442 
Line 443 
 }  }
   
 /*  /*
    * Check if "win" is a pointer to an existing window.
    */
           int
   win_valid(win)
           WIN             *win;
   {
           WIN     *wp;
   
           for (wp = firstwin; wp != NULL; wp = wp->w_next)
                   if (wp == win)
                           return TRUE;
           return FALSE;
   }
   
   /*
  * Return the number of windows.   * Return the number of windows.
  */   */
         int          int
Line 490 
Line 506 
                 win_new_height(curwin, curwin->w_height - STATUS_HEIGHT);                  win_new_height(curwin, curwin->w_height - STATUS_HEIGHT);
         }          }
   
   #ifdef AUTOCMD
 /*  /*
    * Don't execute autocommands while creating the windows.  Must do that
    * when putting the buffers in the windows.
    */
           ++autocmd_busy;
   #endif
   
   /*
  * set 'splitbelow' off for a moment, don't want that now   * set 'splitbelow' off for a moment, don't want that now
  */   */
         p_sb_save = p_sb;          p_sb_save = p_sb;
Line 502 
Line 526 
                         break;                          break;
         p_sb = p_sb_save;          p_sb = p_sb_save;
   
   #ifdef AUTOCMD
           --autocmd_busy;
   #endif
   
                 /* return actual number of windows */                  /* return actual number of windows */
         return (count - todo);          return (count - todo);
 }  }
Line 750 
Line 778 
         int             free_buf;          int             free_buf;
 {  {
         WIN     *wp;          WIN     *wp;
   #ifdef AUTOCMD
           int             other_buffer = FALSE;
   #endif
   
         if (lastwin == firstwin)          if (lastwin == firstwin)
         {          {
Line 757 
Line 788 
                 return;                  return;
         }          }
   
   #ifdef AUTOCMD
           if (win == curwin)
           {
                   /*
                    * Guess which window is going to be the new current window.
                    * This may change because of the autocommands (sigh).
                    */
                   if ((!p_sb && win->w_next != NULL) || win->w_prev == NULL)
                           wp = win->w_next;
                   else
                           wp = win->w_prev;
   
                   /*
                    * Be careful: If autocommands delete the window, return now.
                    */
                   if (wp->w_buffer != curbuf)
                   {
                           other_buffer = TRUE;
                           apply_autocmds(EVENT_BUFLEAVE, NULL, NULL);
                           if (!win_valid(win))
                                   return;
                   }
                   apply_autocmds(EVENT_WINLEAVE, NULL, NULL);
                   if (!win_valid(win))
                           return;
           }
   #endif
   
 /*  /*
  * Remove the window.   * Remove the window.
  * if 'splitbelow' the free space goes to the window above it.   * if 'splitbelow' the free space goes to the window above it.
Line 774 
Line 833 
                 wp = win->w_prev;                  wp = win->w_prev;
         win_new_height(wp, wp->w_height + win->w_height + win->w_status_height);          win_new_height(wp, wp->w_height + win->w_height + win->w_status_height);
   
 #ifdef AUTOCMD  
         if (win == curwin)  
         {  
                 if (wp->w_buffer != curbuf)  
                         apply_autocmds(EVENT_BUFLEAVE, NULL, NULL);  
                 apply_autocmds(EVENT_WINLEAVE, NULL, NULL);  
         }  
 #endif  
   
 /*  /*
  * Close the link to the buffer.   * Close the link to the buffer.
  */   */
Line 794 
Line 844 
         if (p_ea)          if (p_ea)
                 win_equal(wp, FALSE);                  win_equal(wp, FALSE);
         if (curwin == NULL)          if (curwin == NULL)
           {
                 win_enter(wp, FALSE);                  win_enter(wp, FALSE);
   #ifdef AUTOCMD
                   if (other_buffer)
                           /* careful: after this wp and win may be invalid! */
                           apply_autocmds(EVENT_BUFENTER, NULL, NULL);
   #endif
           }
   
         /*          /*
          * if last window has status line now and we don't want one,           * if last window has status line now and we don't want one,
          * remove the status line           * remove the status line
Line 808 
Line 866 
         }          }
   
         updateScreen(NOT_VALID);          updateScreen(NOT_VALID);
         if (RedrawingDisabled)          if (RedrawingDisabled && win_valid(wp))
                 comp_Botline(wp);                       /* need to do this before cursupdate() */                  comp_Botline(wp);                       /* need to do this before cursupdate() */
 }  }
   
Line 889 
Line 947 
 }  }
   
 /*  /*
  * make window wp the current window   * Make window wp the current window.
    * Can be called when curwin == NULL, if curwin already has been closed.
  */   */
         void          void
 win_enter(wp, undo_sync)  win_enter(wp, undo_sync)
Line 906 
Line 965 
 #ifdef AUTOCMD  #ifdef AUTOCMD
         if (curwin != NULL)          if (curwin != NULL)
         {          {
                   /*
                    * Be careful: If autocommands delete the window, return now.
                    */
                 if (wp->w_buffer != curbuf)                  if (wp->w_buffer != curbuf)
                 {                  {
                         apply_autocmds(EVENT_BUFLEAVE, NULL, NULL);                          apply_autocmds(EVENT_BUFLEAVE, NULL, NULL);
                         other_buffer = TRUE;                          other_buffer = TRUE;
                           if (!win_valid(wp))
                                   return;
                 }                  }
                 apply_autocmds(EVENT_WINLEAVE, NULL, NULL);                  apply_autocmds(EVENT_WINLEAVE, NULL, NULL);
                   if (!win_valid(wp))
                           return;
         }          }
 #endif  #endif
   
Line 920 
Line 986 
                 u_sync();                  u_sync();
                 /* may have to copy the buffer options when 'cpo' contains 'S' */                  /* may have to copy the buffer options when 'cpo' contains 'S' */
         if (wp->w_buffer != curbuf)          if (wp->w_buffer != curbuf)
                 buf_copy_options(curbuf, wp->w_buffer, TRUE);                  buf_copy_options(curbuf, wp->w_buffer, TRUE, FALSE);
         if (curwin != NULL)          if (curwin != NULL)
                 prevwin = curwin;               /* remember for CTRL-W p */                  prevwin = curwin;               /* remember for CTRL-W p */
         curwin = wp;          curwin = wp;
Line 1507 
Line 1573 
                         if (len != 0)                          if (len != 0)
                         {                          {
                                                                 /* Look for file relative to current file */                                                                  /* Look for file relative to current file */
                                 if (file_name[0] == '.' && curr_path_len > 0)                                  if (file_name[0] == '.' && curr_path_len > 0 &&
                                                                                   (len == 1 || ispathsep(file_name[1])))
                                 {                                  {
                                         if (len == 1)           /* just a "." */                                          if (len == 1)           /* just a "." */
                                                 len = 0;                                                  len = 0;

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2