Mercurial > vim
comparison src/message.c @ 1883:c8f343a465a2 v7.2.180
updated for version 7.2-180
author | vimboss |
---|---|
date | Sun, 17 May 2009 11:33:22 +0000 |
parents | a58806285f20 |
children | 75a69023117c |
comparison
equal
deleted
inserted
replaced
1882:c8b87fa14d27 | 1883:c8f343a465a2 |
---|---|
816 } | 816 } |
817 | 817 |
818 /* | 818 /* |
819 * ":messages" command. | 819 * ":messages" command. |
820 */ | 820 */ |
821 /*ARGSUSED*/ | |
822 void | 821 void |
823 ex_messages(eap) | 822 ex_messages(eap) |
824 exarg_T *eap; | 823 exarg_T *eap UNUSED; |
825 { | 824 { |
826 struct msg_hist *p; | 825 struct msg_hist *p; |
827 char_u *s; | 826 char_u *s; |
828 | 827 |
829 msg_hist_off = TRUE; | 828 msg_hist_off = TRUE; |
3288 * The second button should be the 'Cancel' button | 3287 * The second button should be the 'Cancel' button |
3289 * Other buttons- use your imagination! | 3288 * Other buttons- use your imagination! |
3290 * A '&' in a button name becomes a shortcut, so each '&' should be before a | 3289 * A '&' in a button name becomes a shortcut, so each '&' should be before a |
3291 * different letter. | 3290 * different letter. |
3292 */ | 3291 */ |
3293 /* ARGSUSED */ | |
3294 int | 3292 int |
3295 do_dialog(type, title, message, buttons, dfltbutton, textfield) | 3293 do_dialog(type, title, message, buttons, dfltbutton, textfield) |
3296 int type; | 3294 int type UNUSED; |
3297 char_u *title; | 3295 char_u *title UNUSED; |
3298 char_u *message; | 3296 char_u *message; |
3299 char_u *buttons; | 3297 char_u *buttons; |
3300 int dfltbutton; | 3298 int dfltbutton; |
3301 char_u *textfield; /* IObuff for inputdialog(), NULL otherwise */ | 3299 char_u *textfield UNUSED; /* IObuff for inputdialog(), NULL |
3300 otherwise */ | |
3302 { | 3301 { |
3303 int oldState; | 3302 int oldState; |
3304 int retval = 0; | 3303 int retval = 0; |
3305 char_u *hotkeys; | 3304 char_u *hotkeys; |
3306 int c; | 3305 int c; |
4019 while (*p != NUL) | 4018 while (*p != NUL) |
4020 { | 4019 { |
4021 if (*p != '%') | 4020 if (*p != '%') |
4022 { | 4021 { |
4023 char *q = strchr(p + 1, '%'); | 4022 char *q = strchr(p + 1, '%'); |
4024 size_t n = (q == NULL) ? STRLEN(p) : (q - p); | 4023 size_t n = (q == NULL) ? STRLEN(p) : (size_t)(q - p); |
4025 | 4024 |
4026 /* Copy up to the next '%' or NUL without any changes. */ | 4025 /* Copy up to the next '%' or NUL without any changes. */ |
4027 if (str_l < str_m) | 4026 if (str_l < str_m) |
4028 { | 4027 { |
4029 size_t avail = str_m - str_l; | 4028 size_t avail = str_m - str_l; |
4266 /* memchr on HP does not like n > 2^31 !!! */ | 4265 /* memchr on HP does not like n > 2^31 !!! */ |
4267 char *q = memchr(str_arg, '\0', | 4266 char *q = memchr(str_arg, '\0', |
4268 precision <= (size_t)0x7fffffffL ? precision | 4267 precision <= (size_t)0x7fffffffL ? precision |
4269 : (size_t)0x7fffffffL); | 4268 : (size_t)0x7fffffffL); |
4270 #endif | 4269 #endif |
4271 str_arg_l = (q == NULL) ? precision : q - str_arg; | 4270 str_arg_l = (q == NULL) ? precision |
4271 : (size_t)(q - str_arg); | |
4272 } | 4272 } |
4273 break; | 4273 break; |
4274 | 4274 |
4275 default: | 4275 default: |
4276 break; | 4276 break; |
4366 uint_arg = | 4366 uint_arg = |
4367 #ifndef HAVE_STDARG_H | 4367 #ifndef HAVE_STDARG_H |
4368 get_a_arg(arg_idx); | 4368 get_a_arg(arg_idx); |
4369 #else | 4369 #else |
4370 # if defined(FEAT_EVAL) | 4370 # if defined(FEAT_EVAL) |
4371 tvs != NULL ? tv_nr(tvs, &arg_idx) : | 4371 tvs != NULL ? (unsigned) |
4372 tv_nr(tvs, &arg_idx) : | |
4372 # endif | 4373 # endif |
4373 va_arg(ap, unsigned int); | 4374 va_arg(ap, unsigned int); |
4374 #endif | 4375 #endif |
4375 if (uint_arg != 0) | 4376 if (uint_arg != 0) |
4376 arg_sign = 1; | 4377 arg_sign = 1; |
4379 ulong_arg = | 4380 ulong_arg = |
4380 #ifndef HAVE_STDARG_H | 4381 #ifndef HAVE_STDARG_H |
4381 get_a_arg(arg_idx); | 4382 get_a_arg(arg_idx); |
4382 #else | 4383 #else |
4383 # if defined(FEAT_EVAL) | 4384 # if defined(FEAT_EVAL) |
4384 tvs != NULL ? tv_nr(tvs, &arg_idx) : | 4385 tvs != NULL ? (unsigned long) |
4386 tv_nr(tvs, &arg_idx) : | |
4385 # endif | 4387 # endif |
4386 va_arg(ap, unsigned long int); | 4388 va_arg(ap, unsigned long int); |
4387 #endif | 4389 #endif |
4388 if (ulong_arg != 0) | 4390 if (ulong_arg != 0) |
4389 arg_sign = 1; | 4391 arg_sign = 1; |
4702 if (str_l < str_m) | 4704 if (str_l < str_m) |
4703 { | 4705 { |
4704 size_t avail = str_m - str_l; | 4706 size_t avail = str_m - str_l; |
4705 | 4707 |
4706 vim_memset(str + str_l, zero_padding ? '0' : ' ', | 4708 vim_memset(str + str_l, zero_padding ? '0' : ' ', |
4707 (size_t)pn > avail ? avail : pn); | 4709 (size_t)pn > avail ? avail |
4710 : (size_t)pn); | |
4708 } | 4711 } |
4709 str_l += pn; | 4712 str_l += pn; |
4710 } | 4713 } |
4711 } | 4714 } |
4712 | 4715 |
4729 if (str_l < str_m) | 4732 if (str_l < str_m) |
4730 { | 4733 { |
4731 size_t avail = str_m - str_l; | 4734 size_t avail = str_m - str_l; |
4732 | 4735 |
4733 mch_memmove(str + str_l, str_arg, | 4736 mch_memmove(str + str_l, str_arg, |
4734 (size_t)zn > avail ? avail : zn); | 4737 (size_t)zn > avail ? avail |
4738 : (size_t)zn); | |
4735 } | 4739 } |
4736 str_l += zn; | 4740 str_l += zn; |
4737 } | 4741 } |
4738 | 4742 |
4739 /* insert zero padding as requested by the precision or min | 4743 /* insert zero padding as requested by the precision or min |
4744 if (str_l < str_m) | 4748 if (str_l < str_m) |
4745 { | 4749 { |
4746 size_t avail = str_m-str_l; | 4750 size_t avail = str_m-str_l; |
4747 | 4751 |
4748 vim_memset(str + str_l, '0', | 4752 vim_memset(str + str_l, '0', |
4749 (size_t)zn > avail ? avail : zn); | 4753 (size_t)zn > avail ? avail |
4754 : (size_t)zn); | |
4750 } | 4755 } |
4751 str_l += zn; | 4756 str_l += zn; |
4752 } | 4757 } |
4753 } | 4758 } |
4754 | 4759 |
4763 { | 4768 { |
4764 size_t avail = str_m - str_l; | 4769 size_t avail = str_m - str_l; |
4765 | 4770 |
4766 mch_memmove(str + str_l, | 4771 mch_memmove(str + str_l, |
4767 str_arg + zero_padding_insertion_ind, | 4772 str_arg + zero_padding_insertion_ind, |
4768 (size_t)sn > avail ? avail : sn); | 4773 (size_t)sn > avail ? avail : (size_t)sn); |
4769 } | 4774 } |
4770 str_l += sn; | 4775 str_l += sn; |
4771 } | 4776 } |
4772 } | 4777 } |
4773 | 4778 |
4783 if (str_l < str_m) | 4788 if (str_l < str_m) |
4784 { | 4789 { |
4785 size_t avail = str_m - str_l; | 4790 size_t avail = str_m - str_l; |
4786 | 4791 |
4787 vim_memset(str + str_l, ' ', | 4792 vim_memset(str + str_l, ' ', |
4788 (size_t)pn > avail ? avail : pn); | 4793 (size_t)pn > avail ? avail |
4794 : (size_t)pn); | |
4789 } | 4795 } |
4790 str_l += pn; | 4796 str_l += pn; |
4791 } | 4797 } |
4792 } | 4798 } |
4793 } | 4799 } |