Bram Moolenaar wrote:

> I wrote:
>
>> We have been running into bugs caused by executing autocommands on a
>> buffer that is not in a visible window.  The latest one was that folds
>> get messed up in the current window, they are refreshed for the wrong
>> buffer.
...snip...
> This is an updated patch that fixes the problem with the scrollbar.
>
>
> *** ../vim-7.2.197/src/fileio.c 2009-05-16 17:29:37.000000000 +0200
> --- src/fileio.c        2009-06-11 21:22:37.000000000 +0200
..snip...


Vim-tiny does not link successfully after applying the patch.
Vim-tiny builds fine without the patch.  This is what I did:

# Check out vim souces, configure vim-tiny and compile... [OK]
$ cvs -z3 -d:pserver:[email protected]:/cvsroot/vim checkout vim7
$ cd vim7/
$ ./configure  --with-features=tiny
$ make
(ok, builds fine)

# Now apply proposed patch, and rebuild -> [FAILS TO LINK]
$ patch -p0 < /tmp/patch
patching file src/fileio.c
patching file src/globals.h
patching file src/gui.c
patching file src/if_perl.xs
patching file src/proto/window.pro
patching file src/screen.c
patching file src/structs.h
patching file src/window.c
$ make
...
objects/window.o: In function `win_alloc_firstwin':
/home/pel/tmp/vim7/src/window.c:3328: undefined reference to `new_frame'
collect2: ld returned 1 exit status
link.sh: Linking doesn't work at all, removing auto/link.sed
make[1]: *** [vim] Error 1


Function new_frame() which is new in the patch is defined in
between #if defined(FEAT_WINDOWS) but it is used at line 3328
outside #if defined(FEAT_WINDOWS).

Adding #ifdef FEAT_WINDOWS around line window.c:3328 makes
it link successfully.  However, vim-tiny does not work, it exits immediately
at this location:

(gdb) bt
#0  win_alloc_firstwin (oldwin=0x0) at window.c:3332
#1  0x080dcf7f in win_alloc_first () at window.c:3255
#2  0x08079ec3 in main (argc=1, argv=0xbfc2f924) at main.c:307

... which is the line just after I added #ifdef FEAT_WINDOWS

3328  #ifdef FEAT_WINDOWS
3329      new_frame(curwin);
3330  #endif
3331      if (curwin->w_frame == NULL)
3332        return FAIL;

I think function new_frame() should be defined outside
#ifdef FEAT_WINDOWS to initialize the first and unique
window when FEAT_WINDOWS is not defined.

Attached patch (on top of proposed patch) fixes vim-tiny.
All tests are successful with "make test".

I'm using Vim-7.2.197 on Linux x86.

Regards
-- Dominique

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

*** window.c.old	2009-06-13 12:59:12.000000000 +0200
--- window.c	2009-06-13 12:55:26.000000000 +0200
***************
*** 10,17 ****
  #include "vim.h"
  
  static int path_is_url __ARGS((char_u *p));
- #if defined(FEAT_WINDOWS) || defined(PROTO)
  static void new_frame __ARGS((win_T *wp));
  static void win_init __ARGS((win_T *newp, win_T *oldp, int flags));
  static void win_init_some __ARGS((win_T *newp, win_T *oldp));
  static void frame_comp_pos __ARGS((frame_T *topfrp, int *row, int *col));
--- 10,17 ----
  #include "vim.h"
  
  static int path_is_url __ARGS((char_u *p));
  static void new_frame __ARGS((win_T *wp));
+ #if defined(FEAT_WINDOWS) || defined(PROTO)
  static void win_init __ARGS((win_T *newp, win_T *oldp, int flags));
  static void win_init_some __ARGS((win_T *newp, win_T *oldp));
  static void frame_comp_pos __ARGS((frame_T *topfrp, int *row, int *col));
***************
*** 1155,1175 ****
  }
  
  
- /*
-  * Create a frame for window "wp".
-  */
-     static void
- new_frame(win_T *wp)
- {
-     frame_T *frp = (frame_T *)alloc_clear((unsigned)sizeof(frame_T));
- 
-     wp->w_frame = frp;
-     if (frp != NULL)
-     {
- 	frp->fr_layout = FR_LEAF;
- 	frp->fr_win = wp;
-     }
- }
  
  /*
   * Initialize window "newp" from window "oldp".
--- 1155,1160 ----
***************
*** 1256,1261 ****
--- 1241,1262 ----
  
  #endif /* FEAT_WINDOWS */
  
+ /*
+  * Create a frame for window "wp".
+  */
+     static void
+ new_frame(win_T *wp)
+ {
+     frame_T *frp = (frame_T *)alloc_clear((unsigned)sizeof(frame_T));
+ 
+     wp->w_frame = frp;
+     if (frp != NULL)
+     {
+ 	frp->fr_layout = FR_LEAF;
+ 	frp->fr_win = wp;
+     }
+ }
+ 
  #if defined(FEAT_WINDOWS) || defined(PROTO)
  /*
   * Check if "win" is a pointer to an existing window.

Raspunde prin e-mail lui