Mercurial > vim
comparison src/option.c @ 26877:06a137af96f8 v8.2.3967
patch 8.2.3967: error messages are spread out
Commit: https://github.com/vim/vim/commit/460ae5dfca31fa627531c263184849976755cf6b
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Jan 1 14:19:49 2022 +0000
patch 8.2.3967: 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 15:30:05 +0100 |
parents | bce848ec8b1b |
children | 7f150a4936f2 |
comparison
equal
deleted
inserted
replaced
26876:601a973ac16c | 26877:06a137af96f8 |
---|---|
3324 need_mouse_correct = TRUE; | 3324 need_mouse_correct = TRUE; |
3325 #endif | 3325 #endif |
3326 | 3326 |
3327 if (curbuf->b_p_sw < 0) | 3327 if (curbuf->b_p_sw < 0) |
3328 { | 3328 { |
3329 errmsg = e_positive; | 3329 errmsg = e_argument_must_be_positive; |
3330 #ifdef FEAT_VARTABS | 3330 #ifdef FEAT_VARTABS |
3331 // Use the first 'vartabstop' value, or 'tabstop' if vts isn't in use. | 3331 // Use the first 'vartabstop' value, or 'tabstop' if vts isn't in use. |
3332 curbuf->b_p_sw = tabstop_count(curbuf->b_p_vts_array) > 0 | 3332 curbuf->b_p_sw = tabstop_count(curbuf->b_p_vts_array) > 0 |
3333 ? tabstop_first(curbuf->b_p_vts_array) | 3333 ? tabstop_first(curbuf->b_p_vts_array) |
3334 : curbuf->b_p_ts; | 3334 : curbuf->b_p_ts; |
3343 if (pp == &p_wh || pp == &p_hh) | 3343 if (pp == &p_wh || pp == &p_hh) |
3344 { | 3344 { |
3345 // 'winheight' and 'helpheight' | 3345 // 'winheight' and 'helpheight' |
3346 if (p_wh < 1) | 3346 if (p_wh < 1) |
3347 { | 3347 { |
3348 errmsg = e_positive; | 3348 errmsg = e_argument_must_be_positive; |
3349 p_wh = 1; | 3349 p_wh = 1; |
3350 } | 3350 } |
3351 if (p_wmh > p_wh) | 3351 if (p_wmh > p_wh) |
3352 { | 3352 { |
3353 errmsg = e_winheight; | 3353 errmsg = e_winheight; |
3354 p_wh = p_wmh; | 3354 p_wh = p_wmh; |
3355 } | 3355 } |
3356 if (p_hh < 0) | 3356 if (p_hh < 0) |
3357 { | 3357 { |
3358 errmsg = e_positive; | 3358 errmsg = e_argument_must_be_positive; |
3359 p_hh = 0; | 3359 p_hh = 0; |
3360 } | 3360 } |
3361 | 3361 |
3362 // Change window height NOW | 3362 // Change window height NOW |
3363 if (!ONE_WINDOW) | 3363 if (!ONE_WINDOW) |
3371 else if (pp == &p_wmh) | 3371 else if (pp == &p_wmh) |
3372 { | 3372 { |
3373 // 'winminheight' | 3373 // 'winminheight' |
3374 if (p_wmh < 0) | 3374 if (p_wmh < 0) |
3375 { | 3375 { |
3376 errmsg = e_positive; | 3376 errmsg = e_argument_must_be_positive; |
3377 p_wmh = 0; | 3377 p_wmh = 0; |
3378 } | 3378 } |
3379 if (p_wmh > p_wh) | 3379 if (p_wmh > p_wh) |
3380 { | 3380 { |
3381 errmsg = e_winheight; | 3381 errmsg = e_winheight; |
3386 else if (pp == &p_wiw) | 3386 else if (pp == &p_wiw) |
3387 { | 3387 { |
3388 // 'winwidth' | 3388 // 'winwidth' |
3389 if (p_wiw < 1) | 3389 if (p_wiw < 1) |
3390 { | 3390 { |
3391 errmsg = e_positive; | 3391 errmsg = e_argument_must_be_positive; |
3392 p_wiw = 1; | 3392 p_wiw = 1; |
3393 } | 3393 } |
3394 if (p_wmw > p_wiw) | 3394 if (p_wmw > p_wiw) |
3395 { | 3395 { |
3396 errmsg = e_winwidth; | 3396 errmsg = e_winwidth; |
3404 else if (pp == &p_wmw) | 3404 else if (pp == &p_wmw) |
3405 { | 3405 { |
3406 // 'winminwidth' | 3406 // 'winminwidth' |
3407 if (p_wmw < 0) | 3407 if (p_wmw < 0) |
3408 { | 3408 { |
3409 errmsg = e_positive; | 3409 errmsg = e_argument_must_be_positive; |
3410 p_wmw = 0; | 3410 p_wmw = 0; |
3411 } | 3411 } |
3412 if (p_wmw > p_wiw) | 3412 if (p_wmw > p_wiw) |
3413 { | 3413 { |
3414 errmsg = e_winwidth; | 3414 errmsg = e_winwidth; |
3464 // 'foldcolumn' | 3464 // 'foldcolumn' |
3465 else if (pp == &curwin->w_p_fdc) | 3465 else if (pp == &curwin->w_p_fdc) |
3466 { | 3466 { |
3467 if (curwin->w_p_fdc < 0) | 3467 if (curwin->w_p_fdc < 0) |
3468 { | 3468 { |
3469 errmsg = e_positive; | 3469 errmsg = e_argument_must_be_positive; |
3470 curwin->w_p_fdc = 0; | 3470 curwin->w_p_fdc = 0; |
3471 } | 3471 } |
3472 else if (curwin->w_p_fdc > 12) | 3472 else if (curwin->w_p_fdc > 12) |
3473 { | 3473 { |
3474 errmsg = e_invalid_argument; | 3474 errmsg = e_invalid_argument; |
3550 // if 'titlelen' has changed, redraw the title | 3550 // if 'titlelen' has changed, redraw the title |
3551 else if (pp == &p_titlelen) | 3551 else if (pp == &p_titlelen) |
3552 { | 3552 { |
3553 if (p_titlelen < 0) | 3553 if (p_titlelen < 0) |
3554 { | 3554 { |
3555 errmsg = e_positive; | 3555 errmsg = e_argument_must_be_positive; |
3556 p_titlelen = 85; | 3556 p_titlelen = 85; |
3557 } | 3557 } |
3558 if (starting != NO_SCREEN && old_value != p_titlelen) | 3558 if (starting != NO_SCREEN && old_value != p_titlelen) |
3559 need_maketitle = TRUE; | 3559 need_maketitle = TRUE; |
3560 } | 3560 } |
3562 // if p_ch changed value, change the command line height | 3562 // if p_ch changed value, change the command line height |
3563 else if (pp == &p_ch) | 3563 else if (pp == &p_ch) |
3564 { | 3564 { |
3565 if (p_ch < 1) | 3565 if (p_ch < 1) |
3566 { | 3566 { |
3567 errmsg = e_positive; | 3567 errmsg = e_argument_must_be_positive; |
3568 p_ch = 1; | 3568 p_ch = 1; |
3569 } | 3569 } |
3570 if (p_ch > Rows - min_rows() + 1) | 3570 if (p_ch > Rows - min_rows() + 1) |
3571 p_ch = Rows - min_rows() + 1; | 3571 p_ch = Rows - min_rows() + 1; |
3572 | 3572 |
3583 // when 'updatecount' changes from zero to non-zero, open swap files | 3583 // when 'updatecount' changes from zero to non-zero, open swap files |
3584 else if (pp == &p_uc) | 3584 else if (pp == &p_uc) |
3585 { | 3585 { |
3586 if (p_uc < 0) | 3586 if (p_uc < 0) |
3587 { | 3587 { |
3588 errmsg = e_positive; | 3588 errmsg = e_argument_must_be_positive; |
3589 p_uc = 100; | 3589 p_uc = 100; |
3590 } | 3590 } |
3591 if (p_uc && !old_value) | 3591 if (p_uc && !old_value) |
3592 ml_open_files(); | 3592 ml_open_files(); |
3593 } | 3593 } |
3594 #ifdef FEAT_CONCEAL | 3594 #ifdef FEAT_CONCEAL |
3595 else if (pp == &curwin->w_p_cole) | 3595 else if (pp == &curwin->w_p_cole) |
3596 { | 3596 { |
3597 if (curwin->w_p_cole < 0) | 3597 if (curwin->w_p_cole < 0) |
3598 { | 3598 { |
3599 errmsg = e_positive; | 3599 errmsg = e_argument_must_be_positive; |
3600 curwin->w_p_cole = 0; | 3600 curwin->w_p_cole = 0; |
3601 } | 3601 } |
3602 else if (curwin->w_p_cole > 3) | 3602 else if (curwin->w_p_cole > 3) |
3603 { | 3603 { |
3604 errmsg = e_invalid_argument; | 3604 errmsg = e_invalid_argument; |
3640 // 'numberwidth' must be positive | 3640 // 'numberwidth' must be positive |
3641 else if (pp == &curwin->w_p_nuw) | 3641 else if (pp == &curwin->w_p_nuw) |
3642 { | 3642 { |
3643 if (curwin->w_p_nuw < 1) | 3643 if (curwin->w_p_nuw < 1) |
3644 { | 3644 { |
3645 errmsg = e_positive; | 3645 errmsg = e_argument_must_be_positive; |
3646 curwin->w_p_nuw = 1; | 3646 curwin->w_p_nuw = 1; |
3647 } | 3647 } |
3648 if (curwin->w_p_nuw > 20) | 3648 if (curwin->w_p_nuw > 20) |
3649 { | 3649 { |
3650 errmsg = e_invalid_argument; | 3650 errmsg = e_invalid_argument; |
3656 | 3656 |
3657 else if (pp == &curbuf->b_p_tw) | 3657 else if (pp == &curbuf->b_p_tw) |
3658 { | 3658 { |
3659 if (curbuf->b_p_tw < 0) | 3659 if (curbuf->b_p_tw < 0) |
3660 { | 3660 { |
3661 errmsg = e_positive; | 3661 errmsg = e_argument_must_be_positive; |
3662 curbuf->b_p_tw = 0; | 3662 curbuf->b_p_tw = 0; |
3663 } | 3663 } |
3664 #ifdef FEAT_SYN_HL | 3664 #ifdef FEAT_SYN_HL |
3665 { | 3665 { |
3666 win_T *wp; | 3666 win_T *wp; |
3724 p_window = Rows - 1; | 3724 p_window = Rows - 1; |
3725 } | 3725 } |
3726 | 3726 |
3727 if (curbuf->b_p_ts <= 0) | 3727 if (curbuf->b_p_ts <= 0) |
3728 { | 3728 { |
3729 errmsg = e_positive; | 3729 errmsg = e_argument_must_be_positive; |
3730 curbuf->b_p_ts = 8; | 3730 curbuf->b_p_ts = 8; |
3731 } | 3731 } |
3732 if (p_tm < 0) | 3732 if (p_tm < 0) |
3733 { | 3733 { |
3734 errmsg = e_positive; | 3734 errmsg = e_argument_must_be_positive; |
3735 p_tm = 0; | 3735 p_tm = 0; |
3736 } | 3736 } |
3737 if ((curwin->w_p_scr <= 0 | 3737 if ((curwin->w_p_scr <= 0 |
3738 || (curwin->w_p_scr > curwin->w_height | 3738 || (curwin->w_p_scr > curwin->w_height |
3739 && curwin->w_height > 0)) | 3739 && curwin->w_height > 0)) |
3752 else // curwin->w_p_scr > curwin->w_height | 3752 else // curwin->w_p_scr > curwin->w_height |
3753 curwin->w_p_scr = curwin->w_height; | 3753 curwin->w_p_scr = curwin->w_height; |
3754 } | 3754 } |
3755 if (p_hi < 0) | 3755 if (p_hi < 0) |
3756 { | 3756 { |
3757 errmsg = e_positive; | 3757 errmsg = e_argument_must_be_positive; |
3758 p_hi = 0; | 3758 p_hi = 0; |
3759 } | 3759 } |
3760 else if (p_hi > 10000) | 3760 else if (p_hi > 10000) |
3761 { | 3761 { |
3762 errmsg = e_invalid_argument; | 3762 errmsg = e_invalid_argument; |
3767 errmsg = e_invalid_argument; | 3767 errmsg = e_invalid_argument; |
3768 p_re = 0; | 3768 p_re = 0; |
3769 } | 3769 } |
3770 if (p_report < 0) | 3770 if (p_report < 0) |
3771 { | 3771 { |
3772 errmsg = e_positive; | 3772 errmsg = e_argument_must_be_positive; |
3773 p_report = 1; | 3773 p_report = 1; |
3774 } | 3774 } |
3775 if ((p_sj < -100 || p_sj >= Rows) && full_screen) | 3775 if ((p_sj < -100 || p_sj >= Rows) && full_screen) |
3776 { | 3776 { |
3777 if (Rows != old_Rows) // Rows changed, just adjust p_sj | 3777 if (Rows != old_Rows) // Rows changed, just adjust p_sj |
3782 p_sj = 1; | 3782 p_sj = 1; |
3783 } | 3783 } |
3784 } | 3784 } |
3785 if (p_so < 0 && full_screen) | 3785 if (p_so < 0 && full_screen) |
3786 { | 3786 { |
3787 errmsg = e_positive; | 3787 errmsg = e_argument_must_be_positive; |
3788 p_so = 0; | 3788 p_so = 0; |
3789 } | 3789 } |
3790 if (p_siso < 0 && full_screen) | 3790 if (p_siso < 0 && full_screen) |
3791 { | 3791 { |
3792 errmsg = e_positive; | 3792 errmsg = e_argument_must_be_positive; |
3793 p_siso = 0; | 3793 p_siso = 0; |
3794 } | 3794 } |
3795 #ifdef FEAT_CMDWIN | 3795 #ifdef FEAT_CMDWIN |
3796 if (p_cwh < 1) | 3796 if (p_cwh < 1) |
3797 { | 3797 { |
3798 errmsg = e_positive; | 3798 errmsg = e_argument_must_be_positive; |
3799 p_cwh = 1; | 3799 p_cwh = 1; |
3800 } | 3800 } |
3801 #endif | 3801 #endif |
3802 if (p_ut < 0) | 3802 if (p_ut < 0) |
3803 { | 3803 { |
3804 errmsg = e_positive; | 3804 errmsg = e_argument_must_be_positive; |
3805 p_ut = 2000; | 3805 p_ut = 2000; |
3806 } | 3806 } |
3807 if (p_ss < 0) | 3807 if (p_ss < 0) |
3808 { | 3808 { |
3809 errmsg = e_positive; | 3809 errmsg = e_argument_must_be_positive; |
3810 p_ss = 0; | 3810 p_ss = 0; |
3811 } | 3811 } |
3812 | 3812 |
3813 // May set global value for local option. | 3813 // May set global value for local option. |
3814 if ((opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0) | 3814 if ((opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0) |