vi: allow 'gg' to specify a range
Commit 7b93e317c (vi: enable 'dG' command. Closes 11801) allowed
'G' to be used as a range specifier for change/yank/delete
operations.
Add similar support for 'gg'.  This requires setting the 'cmd_error'
flag if 'g' is followed by any character other than another 'g'.
function                                             old     new   delta
do_cmd                                              4852    4860      +8
.rodata                                           108179  108180      +1
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 9/0)                 Total: 9 bytes
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
			
			
This commit is contained in:
		
				
					committed by
					
						
						Denys Vlasenko
					
				
			
			
				
	
			
			
			
						parent
						
							ab755e3717
						
					
				
				
					commit
					b50ac07cba
				
			@@ -3437,7 +3437,7 @@ static int find_range(char **start, char **stop, int cmd)
 | 
			
		||||
		// for non-change operations WS after NL is not part of word
 | 
			
		||||
		if (cmd != 'c' && dot != t && *dot != '\n')
 | 
			
		||||
			dot = t;
 | 
			
		||||
	} else if (strchr("GHL+-jk'\r\n", c)) {
 | 
			
		||||
	} else if (strchr("GHL+-gjk'\r\n", c)) {
 | 
			
		||||
		// these operate on whole lines
 | 
			
		||||
		buftype = WHOLE;
 | 
			
		||||
		do_cmd(c);		// execute movement cmd
 | 
			
		||||
@@ -4027,6 +4027,7 @@ static void do_cmd(int c)
 | 
			
		||||
			buf[1] = (c1 >= 0 ? c1 : '*');
 | 
			
		||||
			buf[2] = '\0';
 | 
			
		||||
			not_implemented(buf);
 | 
			
		||||
			cmd_error = TRUE;
 | 
			
		||||
			break;
 | 
			
		||||
		}
 | 
			
		||||
		if (cmdcnt == 0)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user