Blob Blame History Raw
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1285
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 7.3.1285
Problem:    No tests for picking a window when selecting an entry in a
	    location list.  Not picking the right window sometimes.
Solution:   Add test 96. Set usable_win appropriately. (Lech Lorens)
Files:	    src/quickfix.c, src/testdir/Makefile, src/testdir/test96.in,
	    src/testdir/test96.ok, src/testdir/Make_amiga.mak,
	    src/testdir/Make_dos.mak, src/testdir/Make_ming.mak,
	    src/testdir/Make_os2.mak, src/testdir/Make_vms.mms


*** ../vim-7.3.1284/src/quickfix.c	2013-06-30 13:57:40.000000000 +0200
--- src/quickfix.c	2013-07-01 21:16:44.000000000 +0200
***************
*** 1635,1641 ****
--- 1635,1644 ----
  	    FOR_ALL_WINDOWS(usable_win_ptr)
  		if (usable_win_ptr->w_llist == ll_ref
  			&& usable_win_ptr->w_buffer->b_p_bt[0] != 'q')
+ 		{
+ 		    usable_win = 1;
  		    break;
+ 		}
  	}
  
  	if (!usable_win)
*** ../vim-7.3.1284/src/testdir/Makefile	2013-05-19 19:16:25.000000000 +0200
--- src/testdir/Makefile	2013-07-01 21:16:44.000000000 +0200
***************
*** 29,35 ****
  		test79.out test80.out test81.out test82.out test83.out \
  		test84.out test85.out test86.out test87.out test88.out \
  		test89.out test90.out test91.out test92.out test93.out \
! 		test94.out test95.out
  
  SCRIPTS_GUI = test16.out
  
--- 29,35 ----
  		test79.out test80.out test81.out test82.out test83.out \
  		test84.out test85.out test86.out test87.out test88.out \
  		test89.out test90.out test91.out test92.out test93.out \
! 		test94.out test95.out test96.out
  
  SCRIPTS_GUI = test16.out
  
*** ../vim-7.3.1284/src/testdir/test96.in	2013-07-01 21:24:26.000000000 +0200
--- src/testdir/test96.in	2013-07-01 21:18:43.000000000 +0200
***************
*** 0 ****
--- 1,139 ----
+ This will test for problems in quickfix:
+ A. incorrectly copying location lists which caused the location list to show a
+    different name than the file that was actually being displayed.
+ B. not reusing the window for which the location list window is opened but
+    instead creating new windows.
+ C. make sure that the location list window is not reused instead of the window
+    it belongs to.
+ 
+ Note: to debug a problem comment out the last ":b 1" in a test and testing will
+ stop at this point.
+ 
+ STARTTEST
+ :so small.vim
+ : enew
+ : w! test.out
+ : b 1
+ : " Set up the test environment:
+ : function! ReadTestProtocol(name)
+ :   let base = substitute(a:name, '\v^test://(.*)%(\.[^.]+)?', '\1', '')
+ :   let word = substitute(base, '\v(.*)\..*', '\1', '')
+ :
+ :   setl modifiable
+ :   setl noreadonly
+ :   setl noswapfile
+ :   setl bufhidden=delete
+ :   %del _
+ :   " For problem 2:
+ :   " 'buftype' has to be set to reproduce the constant opening of new windows
+ :   setl buftype=nofile
+ :
+ :   call setline(1, word)
+ :
+ :   setl nomodified
+ :   setl nomodifiable
+ :   setl readonly
+ :   exe 'doautocmd BufRead ' . substitute(a:name, '\v^test://(.*)', '\1', '')
+ : endfunction
+ : augroup testgroup
+ :   au!
+ :   autocmd BufReadCmd test://* call ReadTestProtocol(expand("<amatch>"))
+ : augroup END
+ : let words = [ "foo", "bar", "baz", "quux", "shmoo", "spam", "eggs" ]
+ :
+ : let qflist = []
+ : for word in words
+ :   call add(qflist, {'filename': 'test://' . word . '.txt', 'text': 'file ' . word . '.txt', })
+ :   " NOTE: problem 1:
+ :   " intentionally not setting 'lnum' so that the quickfix entries are not
+ :   " valid
+ :   call setloclist(0, qflist, ' ')
+ : endfor
+ ENDTEST
+ 
+ Test A:
+ STARTTEST
+ :lrewind
+ :enew
+ :lopen
+ :lnext
+ :lnext
+ :lnext
+ :lnext
+ :vert split
+ :wincmd L
+ :lopen
+ :wincmd p
+ :lnext
+ :"b 1
+ :let fileName = expand("%")
+ :wincmd p
+ :let locationListFileName = substitute(getline(line('.')), '\([^|]*\)|.*', '\1', '')
+ :wincmd n
+ :wincmd K
+ :b test.out
+ :call append(line('$'), "Test A:")
+ :call append(line('$'), "  - file name displayed: " . fileName)
+ :call append(line('$'), "  - quickfix claims that the file name displayed is: " . locationListFileName)
+ :w
+ :wincmd o
+ :b 1
+ ENDTEST
+ 
+ Test B:
+ STARTTEST
+ :lrewind
+ :lopen
+ :2
+ :exe "normal \<CR>"
+ :wincmd p
+ :3
+ :exe "normal \<CR>"
+ :wincmd p
+ :4
+ :exe "normal \<CR>"
+ :let numberOfWindowsOpen = winnr('$')
+ :wincmd n
+ :wincmd K
+ :b test.out
+ :call append(line('$'), "Test B:")
+ :call append(line('$'), "  - number of window open: " . numberOfWindowsOpen)
+ :w
+ :wincmd o
+ :b 1
+ ENDTEST
+ 
+ Test C:
+ STARTTEST
+ :lrewind
+ :lopen
+ :" Let's move the location list window to the top to check whether it (the first
+ :" window found) will be reused when we try to open new windows:
+ :wincmd K
+ :2
+ :exe "normal \<CR>"
+ :wincmd p
+ :3
+ :exe "normal \<CR>"
+ :wincmd p
+ :4
+ :exe "normal \<CR>"
+ :1wincmd w
+ :let locationListWindowBufType = &buftype
+ :2wincmd w
+ :let bufferName = expand("%")
+ :wincmd n
+ :wincmd K
+ :b test.out
+ :call append(line('$'), "Test C:")
+ :call append(line('$'), "  - 'buftype' of the location list window: " . locationListWindowBufType)
+ :call append(line('$'), "  - buffer displayed in the 2nd window: " . bufferName)
+ :w
+ :wincmd o
+ :b 1
+ ENDTEST
+ 
+ STARTTEST
+ :qa
+ ENDTEST
+ 
*** ../vim-7.3.1284/src/testdir/test96.ok	2013-07-01 21:24:26.000000000 +0200
--- src/testdir/test96.ok	2013-07-01 21:16:44.000000000 +0200
***************
*** 0 ****
--- 1,9 ----
+ 
+ Test A:
+   - file name displayed: test://bar.txt
+   - quickfix claims that the file name displayed is: test://bar.txt
+ Test B:
+   - number of window open: 2
+ Test C:
+   - 'buftype' of the location list window: quickfix
+   - buffer displayed in the 2nd window: test://quux.txt
*** ../vim-7.3.1284/src/testdir/Make_amiga.mak	2013-05-19 19:16:25.000000000 +0200
--- src/testdir/Make_amiga.mak	2013-07-01 21:20:38.000000000 +0200
***************
*** 33,39 ****
  		test76.out test77.out test78.out test79.out test80.out \
  		test81.out test82.out test83.out test84.out test88.out \
  		test89.out test90.out test91.out test92.out test93.out \
! 		test94.out test95.out
  
  .SUFFIXES: .in .out
  
--- 33,39 ----
  		test76.out test77.out test78.out test79.out test80.out \
  		test81.out test82.out test83.out test84.out test88.out \
  		test89.out test90.out test91.out test92.out test93.out \
! 		test94.out test95.out test96.out
  
  .SUFFIXES: .in .out
  
***************
*** 145,147 ****
--- 145,148 ----
  test93.out: test93.in
  test94.out: test94.in
  test95.out: test95.in
+ test96.out: test96.in
*** ../vim-7.3.1284/src/testdir/Make_dos.mak	2013-06-17 21:53:33.000000000 +0200
--- src/testdir/Make_dos.mak	2013-07-01 21:20:47.000000000 +0200
***************
*** 32,38 ****
  		test79.out test80.out test81.out test82.out test83.out \
  		test84.out test85.out test86.out test87.out test88.out \
  		test89.out test90.out test91.out test92.out test93.out \
! 		test94.out test95.out
  
  SCRIPTS32 =	test50.out test70.out
  
--- 32,38 ----
  		test79.out test80.out test81.out test82.out test83.out \
  		test84.out test85.out test86.out test87.out test88.out \
  		test89.out test90.out test91.out test92.out test93.out \
! 		test94.out test95.out test96.out
  
  SCRIPTS32 =	test50.out test70.out
  
*** ../vim-7.3.1284/src/testdir/Make_ming.mak	2013-05-19 19:16:25.000000000 +0200
--- src/testdir/Make_ming.mak	2013-07-01 21:20:52.000000000 +0200
***************
*** 52,58 ****
  		test79.out test80.out test81.out test82.out test83.out \
  		test84.out test85.out test86.out test87.out test88.out \
  		test89.out test90.out test91.out test92.out test93.out \
! 		test94.out test95.out
  
  SCRIPTS32 =	test50.out test70.out
  
--- 52,58 ----
  		test79.out test80.out test81.out test82.out test83.out \
  		test84.out test85.out test86.out test87.out test88.out \
  		test89.out test90.out test91.out test92.out test93.out \
! 		test94.out test95.out test96.out
  
  SCRIPTS32 =	test50.out test70.out
  
*** ../vim-7.3.1284/src/testdir/Make_os2.mak	2013-05-19 19:16:25.000000000 +0200
--- src/testdir/Make_os2.mak	2013-07-01 21:20:58.000000000 +0200
***************
*** 33,39 ****
  		test76.out test77.out test78.out test79.out test80.out \
  		test81.out test82.out test83.out test84.out test88.out \
  		test89.out test90.out test91.out test92.out test93.out \
! 		test94.out test95.out
  
  .SUFFIXES: .in .out
  
--- 33,39 ----
  		test76.out test77.out test78.out test79.out test80.out \
  		test81.out test82.out test83.out test84.out test88.out \
  		test89.out test90.out test91.out test92.out test93.out \
! 		test94.out test95.out test96.out
  
  .SUFFIXES: .in .out
  
*** ../vim-7.3.1284/src/testdir/Make_vms.mms	2013-05-19 19:16:25.000000000 +0200
--- src/testdir/Make_vms.mms	2013-07-01 21:21:04.000000000 +0200
***************
*** 4,10 ****
  # Authors:	Zoltan Arpadffy, <arpadffy@polarhome.com>
  #		Sandor Kopanyi,  <sandor.kopanyi@mailbox.hu>
  #
! # Last change:  2013 May 18
  #
  # This has been tested on VMS 6.2 to 8.3 on DEC Alpha, VAX and IA64.
  # Edit the lines in the Configuration section below to select.
--- 4,10 ----
  # Authors:	Zoltan Arpadffy, <arpadffy@polarhome.com>
  #		Sandor Kopanyi,  <sandor.kopanyi@mailbox.hu>
  #
! # Last change:  2013 Jul 01
  #
  # This has been tested on VMS 6.2 to 8.3 on DEC Alpha, VAX and IA64.
  # Edit the lines in the Configuration section below to select.
***************
*** 78,84 ****
  	 test77.out test78.out test79.out test80.out test81.out \
  	 test82.out test83.out test84.out test88.out test89.out \
  	 test90.out test91.out test92.out test93.out test94.out \
! 	 test95.out
  
  # Known problems:
  # Test 30: a problem around mac format - unknown reason
--- 78,84 ----
  	 test77.out test78.out test79.out test80.out test81.out \
  	 test82.out test83.out test84.out test88.out test89.out \
  	 test90.out test91.out test92.out test93.out test94.out \
! 	 test95.out test96.out
  
  # Known problems:
  # Test 30: a problem around mac format - unknown reason
*** ../vim-7.3.1284/src/version.c	2013-07-01 21:08:44.000000000 +0200
--- src/version.c	2013-07-01 21:18:12.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
  {   /* Add new patch number below this line */
+ /**/
+     1285,
  /**/

-- 
No letters of the alphabet were harmed in the creation of this message.

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///