Karsten Hopp 8d89a9
To: vim_dev@googlegroups.com
Karsten Hopp 8d89a9
Subject: Patch 7.4.561
Karsten Hopp 8d89a9
Fcc: outbox
Karsten Hopp 8d89a9
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 8d89a9
Mime-Version: 1.0
Karsten Hopp 8d89a9
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 8d89a9
Content-Transfer-Encoding: 8bit
Karsten Hopp 8d89a9
------------
Karsten Hopp 8d89a9
Karsten Hopp 8d89a9
Patch 7.4.561
Karsten Hopp 8d89a9
Problem:    Ex range handling is wrong for buffer-local user commands.
Karsten Hopp 8d89a9
Solution:   Check for CMD_USER_BUF. (Marcin Szamotulski)
Karsten Hopp 8d89a9
Files:	    src/ex_docmd.c, src/testdir/test_command_count.in,
Karsten Hopp 8d89a9
	    src/testdir/test_command_count.ok
Karsten Hopp 8d89a9
Karsten Hopp 8d89a9
Karsten Hopp 8d89a9
*** ../vim-7.4.560/src/ex_docmd.c	2014-12-08 04:16:26.265702875 +0100
Karsten Hopp 8d89a9
--- src/ex_docmd.c	2015-01-07 13:11:45.740538584 +0100
Karsten Hopp 8d89a9
***************
Karsten Hopp 8d89a9
*** 2133,2144 ****
Karsten Hopp 8d89a9
      if (ea.cmdidx != CMD_SIZE
Karsten Hopp 8d89a9
  #ifdef FEAT_USR_CMDS
Karsten Hopp 8d89a9
  	&& ea.cmdidx != CMD_USER
Karsten Hopp 8d89a9
  #endif
Karsten Hopp 8d89a9
         )
Karsten Hopp 8d89a9
  	ea.addr_type = cmdnames[(int)ea.cmdidx].cmd_addr_type;
Karsten Hopp 8d89a9
      else
Karsten Hopp 8d89a9
  #ifdef FEAT_USR_CMDS
Karsten Hopp 8d89a9
! 	if (ea.cmdidx != CMD_USER)
Karsten Hopp 8d89a9
  #endif
Karsten Hopp 8d89a9
  	ea.addr_type = ADDR_LINES;
Karsten Hopp 8d89a9
      /* ea.addr_type for user commands is set by find_ucmd */
Karsten Hopp 8d89a9
--- 2133,2145 ----
Karsten Hopp 8d89a9
      if (ea.cmdidx != CMD_SIZE
Karsten Hopp 8d89a9
  #ifdef FEAT_USR_CMDS
Karsten Hopp 8d89a9
  	&& ea.cmdidx != CMD_USER
Karsten Hopp 8d89a9
+ 	&& ea.cmdidx != CMD_USER_BUF
Karsten Hopp 8d89a9
  #endif
Karsten Hopp 8d89a9
         )
Karsten Hopp 8d89a9
  	ea.addr_type = cmdnames[(int)ea.cmdidx].cmd_addr_type;
Karsten Hopp 8d89a9
      else
Karsten Hopp 8d89a9
  #ifdef FEAT_USR_CMDS
Karsten Hopp 8d89a9
! 	if (ea.cmdidx != CMD_USER && ea.cmdidx != CMD_USER_BUF)
Karsten Hopp 8d89a9
  #endif
Karsten Hopp 8d89a9
  	ea.addr_type = ADDR_LINES;
Karsten Hopp 8d89a9
      /* ea.addr_type for user commands is set by find_ucmd */
Karsten Hopp 8d89a9
*** ../vim-7.4.560/src/testdir/test_command_count.in	2014-12-08 04:16:26.249703054 +0100
Karsten Hopp 8d89a9
--- src/testdir/test_command_count.in	2015-01-07 13:12:34.099980778 +0100
Karsten Hopp 8d89a9
***************
Karsten Hopp 8d89a9
*** 3,9 ****
Karsten Hopp 8d89a9
  STARTTEST
Karsten Hopp 8d89a9
  :let g:lines = []
Karsten Hopp 8d89a9
  :so tiny.vim
Karsten Hopp 8d89a9
! :com -range RangeLines :call add(g:lines, 'Rangeg:Lines '.<line1>.' '.<line2>)
Karsten Hopp 8d89a9
  :com -range -addr=arguments RangeArguments :call add(g:lines, 'RangeArguments '.<line1>.' '.<line2>)
Karsten Hopp 8d89a9
  :com -range=% -addr=arguments RangeArgumentsAll :call add(g:lines, 'RangeArgumentsAll '.<line1>.' '.<line2>)
Karsten Hopp 8d89a9
  :com -range -addr=loaded_buffers RangeLoadedBuffers :call add(g:lines, 'RangeLoadedBuffers '.<line1>.' '.<line2>)
Karsten Hopp 8d89a9
--- 3,9 ----
Karsten Hopp 8d89a9
  STARTTEST
Karsten Hopp 8d89a9
  :let g:lines = []
Karsten Hopp 8d89a9
  :so tiny.vim
Karsten Hopp 8d89a9
! :com -range=% RangeLines :call add(g:lines, 'RangeLines '.<line1>.' '.<line2>)
Karsten Hopp 8d89a9
  :com -range -addr=arguments RangeArguments :call add(g:lines, 'RangeArguments '.<line1>.' '.<line2>)
Karsten Hopp 8d89a9
  :com -range=% -addr=arguments RangeArgumentsAll :call add(g:lines, 'RangeArgumentsAll '.<line1>.' '.<line2>)
Karsten Hopp 8d89a9
  :com -range -addr=loaded_buffers RangeLoadedBuffers :call add(g:lines, 'RangeLoadedBuffers '.<line1>.' '.<line2>)
Karsten Hopp 8d89a9
***************
Karsten Hopp 8d89a9
*** 42,47 ****
Karsten Hopp 8d89a9
--- 42,53 ----
Karsten Hopp 8d89a9
  :%RangeTabs
Karsten Hopp 8d89a9
  :RangeTabsAll
Karsten Hopp 8d89a9
  :1tabonly
Karsten Hopp 8d89a9
+ :s/\n/\r\r\r\r\r/
Karsten Hopp 8d89a9
+ :2ma<
Karsten Hopp 8d89a9
+ :$-ma>
Karsten Hopp 8d89a9
+ :'<,'>RangeLines
Karsten Hopp 8d89a9
+ :com -range=% -buffer LocalRangeLines :call add(g:lines, 'LocalRangeLines '.<line1>.' '.<line2>)
Karsten Hopp 8d89a9
+ :'<,'>LocalRangeLines
Karsten Hopp 8d89a9
  :e! test.out
Karsten Hopp 8d89a9
  :call append(0, g:lines)
Karsten Hopp 8d89a9
  :w|qa!
Karsten Hopp 8d89a9
*** ../vim-7.4.560/src/testdir/test_command_count.ok	2014-12-08 04:16:26.249703054 +0100
Karsten Hopp 8d89a9
--- src/testdir/test_command_count.ok	2015-01-07 12:59:08.657271709 +0100
Karsten Hopp 8d89a9
***************
Karsten Hopp 8d89a9
*** 14,17 ****
Karsten Hopp 8d89a9
--- 14,19 ----
Karsten Hopp 8d89a9
  RangeTabs 2 5
Karsten Hopp 8d89a9
  RangeTabs 1 5
Karsten Hopp 8d89a9
  RangeTabsAll 1 5
Karsten Hopp 8d89a9
+ RangeLines 2 5
Karsten Hopp 8d89a9
+ LocalRangeLines 2 5
Karsten Hopp 8d89a9
  
Karsten Hopp 8d89a9
*** ../vim-7.4.560/src/version.c	2014-12-17 21:00:44.989871256 +0100
Karsten Hopp 8d89a9
--- src/version.c	2015-01-07 12:58:04.754008894 +0100
Karsten Hopp 8d89a9
***************
Karsten Hopp 8d89a9
*** 743,744 ****
Karsten Hopp 8d89a9
--- 743,746 ----
Karsten Hopp 8d89a9
  {   /* Add new patch number below this line */
Karsten Hopp 8d89a9
+ /**/
Karsten Hopp 8d89a9
+     561,
Karsten Hopp 8d89a9
  /**/
Karsten Hopp 8d89a9
Karsten Hopp 8d89a9
-- 
Karsten Hopp 8d89a9
Q: What is a patch 22?
Karsten Hopp 8d89a9
A: A patch you need to include to make it possible to include patches.
Karsten Hopp 8d89a9
Karsten Hopp 8d89a9
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 8d89a9
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 8d89a9
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp 8d89a9
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///