comparison src/if_ruby.c @ 23422:bb0c53f4ef8b v8.2.2254

patch 8.2.2254: Vim9: bool option type is number Commit: https://github.com/vim/vim/commit/dd1f426bd617ac6a775f2e7795ff0b159e3fa315 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Dec 31 17:41:01 2020 +0100 patch 8.2.2254: Vim9: bool option type is number Problem: Vim9: bool option type is number. Solution: Have get_option_value() return a different value for bool and number options. (closes #7583)
author Bram Moolenaar <Bram@vim.org>
date Thu, 31 Dec 2020 17:45:04 +0100
parents f719577ddae6
children 19d54961af72
comparison
equal deleted inserted replaced
23421:4ac86caf4c42 23422:bb0c53f4ef8b
863 */ 863 */
864 static VALUE 864 static VALUE
865 vim_str2rb_enc_str(const char *s) 865 vim_str2rb_enc_str(const char *s)
866 { 866 {
867 #if RUBY_VERSION >= 19 867 #if RUBY_VERSION >= 19
868 int isnum;
869 long lval; 868 long lval;
870 char_u *sval; 869 char_u *sval;
871 rb_encoding *enc; 870 rb_encoding *enc;
872 871
873 isnum = get_option_value((char_u *)"enc", &lval, &sval, 0); 872 if (get_option_value((char_u *)"enc", &lval, &sval, 0) == gov_string)
874 if (isnum == 0)
875 { 873 {
876 enc = rb_enc_find((char *)sval); 874 enc = rb_enc_find((char *)sval);
877 vim_free(sval); 875 vim_free(sval);
878 if (enc) 876 if (enc)
879 return rb_enc_str_new(s, (long)strlen(s), enc); 877 return rb_enc_str_new(s, (long)strlen(s), enc);
884 882
885 static VALUE 883 static VALUE
886 eval_enc_string_protect(const char *str, int *state) 884 eval_enc_string_protect(const char *str, int *state)
887 { 885 {
888 #if RUBY_VERSION >= 19 886 #if RUBY_VERSION >= 19
889 int isnum;
890 long lval; 887 long lval;
891 char_u *sval; 888 char_u *sval;
892 rb_encoding *enc; 889 rb_encoding *enc;
893 VALUE v; 890 VALUE v;
894 891
895 isnum = get_option_value((char_u *)"enc", &lval, &sval, 0); 892 if (get_option_value((char_u *)"enc", &lval, &sval, 0) == gov_string)
896 if (isnum == 0)
897 { 893 {
898 enc = rb_enc_find((char *)sval); 894 enc = rb_enc_find((char *)sval);
899 vim_free(sval); 895 vim_free(sval);
900 if (enc) 896 if (enc)
901 { 897 {