comparison src/ex_docmd.c @ 17650:a1437b8f2fac v8.1.1822

patch 8.1.1822: confusing error message when range is not allowed commit https://github.com/vim/vim/commit/0acae7acc40b9f12bff88d5e1dae494a761fec07 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Aug 6 21:29:29 2019 +0200 patch 8.1.1822: confusing error message when range is not allowed Problem: Confusing error message when range is not allowed. Solution: With ADDR_NONE give e_norange. Change e_invaddr to e_invrange for consistency.
author Bram Moolenaar <Bram@vim.org>
date Tue, 06 Aug 2019 21:30:06 +0200
parents daa1dea1c1b3
children 9efb4dda9720
comparison
equal deleted inserted replaced
17649:221733de15e7 17650:a1437b8f2fac
4206 cmd = skipwhite(cmd + 1); 4206 cmd = skipwhite(cmd + 1);
4207 4207
4208 return cmd; 4208 return cmd;
4209 } 4209 }
4210 4210
4211 static void
4212 addr_error(cmd_addr_T addr_type)
4213 {
4214 if (addr_type == ADDR_NONE)
4215 emsg(_(e_norange));
4216 else
4217 emsg(_(e_invrange));
4218 }
4219
4211 /* 4220 /*
4212 * Get a single EX address. 4221 * Get a single EX address.
4213 * 4222 *
4214 * Set ptr to the next character after the part that was interpreted. 4223 * Set ptr to the next character after the part that was interpreted.
4215 * Set ptr to NULL when an error is encountered. 4224 * Set ptr to NULL when an error is encountered.
4262 lnum = curbuf->b_fnum; 4271 lnum = curbuf->b_fnum;
4263 break; 4272 break;
4264 case ADDR_TABS: 4273 case ADDR_TABS:
4265 lnum = CURRENT_TAB_NR; 4274 lnum = CURRENT_TAB_NR;
4266 break; 4275 break;
4276 case ADDR_NONE:
4267 case ADDR_TABS_RELATIVE: 4277 case ADDR_TABS_RELATIVE:
4268 case ADDR_NONE:
4269 case ADDR_UNSIGNED: 4278 case ADDR_UNSIGNED:
4270 emsg(_(e_invrange)); 4279 addr_error(addr_type);
4271 cmd = NULL; 4280 cmd = NULL;
4272 goto error; 4281 goto error;
4273 break; 4282 break;
4274 case ADDR_QUICKFIX: 4283 case ADDR_QUICKFIX:
4275 #ifdef FEAT_QUICKFIX 4284 #ifdef FEAT_QUICKFIX
4312 lnum = lastbuf->b_fnum; 4321 lnum = lastbuf->b_fnum;
4313 break; 4322 break;
4314 case ADDR_TABS: 4323 case ADDR_TABS:
4315 lnum = LAST_TAB_NR; 4324 lnum = LAST_TAB_NR;
4316 break; 4325 break;
4326 case ADDR_NONE:
4317 case ADDR_TABS_RELATIVE: 4327 case ADDR_TABS_RELATIVE:
4318 case ADDR_NONE:
4319 case ADDR_UNSIGNED: 4328 case ADDR_UNSIGNED:
4320 emsg(_(e_invrange)); 4329 addr_error(addr_type);
4321 cmd = NULL; 4330 cmd = NULL;
4322 goto error; 4331 goto error;
4323 break; 4332 break;
4324 case ADDR_QUICKFIX: 4333 case ADDR_QUICKFIX:
4325 #ifdef FEAT_QUICKFIX 4334 #ifdef FEAT_QUICKFIX
4344 cmd = NULL; 4353 cmd = NULL;
4345 goto error; 4354 goto error;
4346 } 4355 }
4347 if (addr_type != ADDR_LINES) 4356 if (addr_type != ADDR_LINES)
4348 { 4357 {
4349 emsg(_(e_invaddr)); 4358 addr_error(addr_type);
4350 cmd = NULL; 4359 cmd = NULL;
4351 goto error; 4360 goto error;
4352 } 4361 }
4353 if (skip) 4362 if (skip)
4354 ++cmd; 4363 ++cmd;
4376 case '/': 4385 case '/':
4377 case '?': /* '/' or '?' - search */ 4386 case '?': /* '/' or '?' - search */
4378 c = *cmd++; 4387 c = *cmd++;
4379 if (addr_type != ADDR_LINES) 4388 if (addr_type != ADDR_LINES)
4380 { 4389 {
4381 emsg(_(e_invaddr)); 4390 addr_error(addr_type);
4382 cmd = NULL; 4391 cmd = NULL;
4383 goto error; 4392 goto error;
4384 } 4393 }
4385 if (skip) /* skip "/pat/" */ 4394 if (skip) /* skip "/pat/" */
4386 { 4395 {
4426 4435
4427 case '\\': /* "\?", "\/" or "\&", repeat search */ 4436 case '\\': /* "\?", "\/" or "\&", repeat search */
4428 ++cmd; 4437 ++cmd;
4429 if (addr_type != ADDR_LINES) 4438 if (addr_type != ADDR_LINES)
4430 { 4439 {
4431 emsg(_(e_invaddr)); 4440 addr_error(addr_type);
4432 cmd = NULL; 4441 cmd = NULL;
4433 goto error; 4442 goto error;
4434 } 4443 }
4435 if (*cmd == '&') 4444 if (*cmd == '&')
4436 i = RE_SUBST; 4445 i = RE_SUBST;
7924 /* 7933 /*
7925 * move or copy lines from 'eap->line1'-'eap->line2' to below line 'n' 7934 * move or copy lines from 'eap->line1'-'eap->line2' to below line 'n'
7926 */ 7935 */
7927 if (n == MAXLNUM || n < 0 || n > curbuf->b_ml.ml_line_count) 7936 if (n == MAXLNUM || n < 0 || n > curbuf->b_ml.ml_line_count)
7928 { 7937 {
7929 emsg(_(e_invaddr)); 7938 emsg(_(e_invrange));
7930 return; 7939 return;
7931 } 7940 }
7932 7941
7933 if (eap->cmdidx == CMD_move) 7942 if (eap->cmdidx == CMD_move)
7934 { 7943 {