comparison src/ex_docmd.c @ 26883:7f150a4936f2 v8.2.3970

patch 8.2.3970: error messages are spread out Commit: https://github.com/vim/vim/commit/74409f62790a93daf0965c71da01ff76aa0fa5a5 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jan 1 15:58:22 2022 +0000 patch 8.2.3970: error messages are spread out Problem: Error messages are spread out. Solution: Move more errors to errors.h.
author Bram Moolenaar <Bram@vim.org>
date Sat, 01 Jan 2022 17:00:04 +0100
parents 06a137af96f8
children aa65d1808bd0
comparison
equal deleted inserted replaced
26882:196f4d7e2a38 26883:7f150a4936f2
520 520
521 if ((prev_line != curwin->w_cursor.lnum 521 if ((prev_line != curwin->w_cursor.lnum
522 || changedtick != CHANGEDTICK(curbuf)) && !ex_no_reprint) 522 || changedtick != CHANGEDTICK(curbuf)) && !ex_no_reprint)
523 { 523 {
524 if (curbuf->b_ml.ml_flags & ML_EMPTY) 524 if (curbuf->b_ml.ml_flags & ML_EMPTY)
525 emsg(_(e_emptybuf)); 525 emsg(_(e_empty_buffer));
526 else 526 else
527 { 527 {
528 if (ex_pressedreturn) 528 if (ex_pressedreturn)
529 { 529 {
530 // go up one line, to overwrite the ":<CR>" line, so the 530 // go up one line, to overwrite the ":<CR>" line, so the
539 } 539 }
540 } 540 }
541 else if (ex_pressedreturn && !ex_no_reprint) // must be at EOF 541 else if (ex_pressedreturn && !ex_no_reprint) // must be at EOF
542 { 542 {
543 if (curbuf->b_ml.ml_flags & ML_EMPTY) 543 if (curbuf->b_ml.ml_flags & ML_EMPTY)
544 emsg(_(e_emptybuf)); 544 emsg(_(e_empty_buffer));
545 else 545 else
546 emsg(_("E501: At end-of-file")); 546 emsg(_("E501: At end-of-file"));
547 } 547 }
548 } 548 }
549 549
2324 { 2324 {
2325 #ifndef FEAT_CLIPBOARD 2325 #ifndef FEAT_CLIPBOARD
2326 // check these explicitly for a more specific error message 2326 // check these explicitly for a more specific error message
2327 if (*ea.arg == '*' || *ea.arg == '+') 2327 if (*ea.arg == '*' || *ea.arg == '+')
2328 { 2328 {
2329 errormsg = _(e_invalidreg); 2329 errormsg = _(e_invalid_register_name);
2330 goto doend; 2330 goto doend;
2331 } 2331 }
2332 #endif 2332 #endif
2333 if (valid_yank_reg(*ea.arg, (ea.cmdidx != CMD_put 2333 if (valid_yank_reg(*ea.arg, (ea.cmdidx != CMD_put
2334 && !IS_USER_CMDIDX(ea.cmdidx)))) 2334 && !IS_USER_CMDIDX(ea.cmdidx))))
2360 { 2360 {
2361 n = getdigits_quoted(&ea.arg); 2361 n = getdigits_quoted(&ea.arg);
2362 ea.arg = skipwhite(ea.arg); 2362 ea.arg = skipwhite(ea.arg);
2363 if (n <= 0 && !ni && (ea.argt & EX_ZEROR) == 0) 2363 if (n <= 0 && !ni && (ea.argt & EX_ZEROR) == 0)
2364 { 2364 {
2365 errormsg = _(e_zerocount); 2365 errormsg = _(e_positive_count_required);
2366 goto doend; 2366 goto doend;
2367 } 2367 }
2368 if (ea.addr_type != ADDR_LINES) // e.g. :buffer 2, :sleep 3 2368 if (ea.addr_type != ADDR_LINES) // e.g. :buffer 2, :sleep 3
2369 { 2369 {
2370 ea.line2 = n; 2370 ea.line2 = n;
2391 get_flags(&ea); 2391 get_flags(&ea);
2392 if (!ni && !(ea.argt & EX_EXTRA) && *ea.arg != NUL 2392 if (!ni && !(ea.argt & EX_EXTRA) && *ea.arg != NUL
2393 && *ea.arg != '"' && (*ea.arg != '|' || (ea.argt & EX_TRLBAR) == 0)) 2393 && *ea.arg != '"' && (*ea.arg != '|' || (ea.argt & EX_TRLBAR) == 0))
2394 { 2394 {
2395 // no arguments allowed but there is something 2395 // no arguments allowed but there is something
2396 errormsg = ex_errmsg(e_trailing_arg, ea.arg); 2396 errormsg = ex_errmsg(e_trailing_characters_str, ea.arg);
2397 goto doend; 2397 goto doend;
2398 } 2398 }
2399 2399
2400 if (!ni && (ea.argt & EX_NEEDARG) && *ea.arg == NUL) 2400 if (!ni && (ea.argt & EX_NEEDARG) && *ea.arg == NUL)
2401 { 2401 {
5351 ex_buffer(exarg_T *eap) 5351 ex_buffer(exarg_T *eap)
5352 { 5352 {
5353 if (ERROR_IF_ANY_POPUP_WINDOW) 5353 if (ERROR_IF_ANY_POPUP_WINDOW)
5354 return; 5354 return;
5355 if (*eap->arg) 5355 if (*eap->arg)
5356 eap->errmsg = ex_errmsg(e_trailing_arg, eap->arg); 5356 eap->errmsg = ex_errmsg(e_trailing_characters_str, eap->arg);
5357 else 5357 else
5358 { 5358 {
5359 if (eap->addr_count == 0) // default is current buffer 5359 if (eap->addr_count == 0) // default is current buffer
5360 goto_buffer(eap, DOBUF_CURRENT, FORWARD, 0); 5360 goto_buffer(eap, DOBUF_CURRENT, FORWARD, 0);
5361 else 5361 else
5858 buf_T *buf = win->w_buffer; 5858 buf_T *buf = win->w_buffer;
5859 5859
5860 // Never close the autocommand window. 5860 // Never close the autocommand window.
5861 if (win == aucmd_win) 5861 if (win == aucmd_win)
5862 { 5862 {
5863 emsg(_(e_autocmd_close)); 5863 emsg(_(e_cannot_close_autocmd_or_popup_window));
5864 return; 5864 return;
5865 } 5865 }
5866 5866
5867 need_hide = (bufIsChanged(buf) && buf->b_nwindows <= 1); 5867 need_hide = (bufIsChanged(buf) && buf->b_nwindows <= 1);
5868 if (need_hide && !buf_hide(buf) && !forceit) 5868 if (need_hide && !buf_hide(buf) && !forceit)
6284 */ 6284 */
6285 static void 6285 static void
6286 ex_print(exarg_T *eap) 6286 ex_print(exarg_T *eap)
6287 { 6287 {
6288 if (curbuf->b_ml.ml_flags & ML_EMPTY) 6288 if (curbuf->b_ml.ml_flags & ML_EMPTY)
6289 emsg(_(e_emptybuf)); 6289 emsg(_(e_empty_buffer));
6290 else 6290 else
6291 { 6291 {
6292 for ( ;!got_int; ui_breakcheck()) 6292 for ( ;!got_int; ui_breakcheck())
6293 { 6293 {
6294 print_line(eap->line1, 6294 print_line(eap->line1,
6769 ex_mode(exarg_T *eap) 6769 ex_mode(exarg_T *eap)
6770 { 6770 {
6771 if (*eap->arg == NUL) 6771 if (*eap->arg == NUL)
6772 shell_resized(); 6772 shell_resized();
6773 else 6773 else
6774 emsg(_(e_screenmode)); 6774 emsg(_(e_screen_mode_setting_not_supported));
6775 } 6775 }
6776 6776
6777 /* 6777 /*
6778 * ":resize". 6778 * ":resize".
6779 * set, increment or decrement current window height 6779 * set, increment or decrement current window height
8325 return; 8325 return;
8326 #endif 8326 #endif
8327 if (*eap->arg == NUL) // No argument? 8327 if (*eap->arg == NUL) // No argument?
8328 emsg(_(e_argument_required)); 8328 emsg(_(e_argument_required));
8329 else if (eap->arg[1] != NUL) // more than one character? 8329 else if (eap->arg[1] != NUL) // more than one character?
8330 semsg(_(e_trailing_arg), eap->arg); 8330 semsg(_(e_trailing_characters_str), eap->arg);
8331 else 8331 else
8332 { 8332 {
8333 pos = curwin->w_cursor; // save curwin->w_cursor 8333 pos = curwin->w_cursor; // save curwin->w_cursor
8334 curwin->w_cursor.lnum = eap->line2; 8334 curwin->w_cursor.lnum = eap->line2;
8335 beginline(BL_WHITE | BL_FIX); 8335 beginline(BL_WHITE | BL_FIX);
8418 int l; 8418 int l;
8419 char_u *p; 8419 char_u *p;
8420 8420
8421 if (ex_normal_lock > 0) 8421 if (ex_normal_lock > 0)
8422 { 8422 {
8423 emsg(_(e_secure)); 8423 emsg(_(e_not_allowed_here));
8424 return; 8424 return;
8425 } 8425 }
8426 if (ex_normal_busy >= p_mmd) 8426 if (ex_normal_busy >= p_mmd)
8427 { 8427 {
8428 emsg(_(e_recursive_use_of_normal_too_deep)); 8428 emsg(_(e_recursive_use_of_normal_too_deep));
8696 *p++ = NUL; 8696 *p++ = NUL;
8697 p = skipwhite(p); 8697 p = skipwhite(p);
8698 8698
8699 // Check for trailing illegal characters 8699 // Check for trailing illegal characters
8700 if (!ends_excmd2(eap->arg, p)) 8700 if (!ends_excmd2(eap->arg, p))
8701 eap->errmsg = ex_errmsg(e_trailing_arg, p); 8701 eap->errmsg = ex_errmsg(e_trailing_characters_str, p);
8702 else 8702 else
8703 set_nextcmd(eap, p); 8703 set_nextcmd(eap, p);
8704 } 8704 }
8705 } 8705 }
8706 if (!eap->skip) 8706 if (!eap->skip)