diff --git a/src/channel.c b/src/channel.c index e405b90ae9..6b6c9bd4be 100644 --- a/src/channel.c +++ b/src/channel.c @@ -1122,7 +1122,7 @@ channel_set_options(channel_T *channel, jobopt_T *opt) *cbp = vim_strsave(opt->jo_close_cb); else *cbp = NULL; - *pp = opt->jo_err_partial; + *pp = opt->jo_close_partial; if (*pp != NULL) ++(*pp)->pt_refcount; } diff --git a/src/if_mzsch.c b/src/if_mzsch.c index d255d4adf1..93e4b6cbba 100644 --- a/src/if_mzsch.c +++ b/src/if_mzsch.c @@ -3109,6 +3109,7 @@ vim_to_mzscheme_impl(typval_T *vim_value, int depth, Scheme_Hash_Table *visited) MZ_GC_VAR_IN_REG(0, funcname); MZ_GC_REG(); + /* FIXME: func_ref() and func_unref() are needed. */ funcname = scheme_make_byte_string((char *)vim_value->vval.v_string); MZ_GC_CHECK(); result = scheme_make_closed_prim_w_arity(vim_funcref, funcname, @@ -3117,6 +3118,30 @@ vim_to_mzscheme_impl(typval_T *vim_value, int depth, Scheme_Hash_Table *visited) MZ_GC_UNREG(); } + else if (vim_value->v_type == VAR_PARTIAL) + { + if (vim_value->vval.v_partial == NULL) + result = scheme_null; + else + { + Scheme_Object *funcname = NULL; + + MZ_GC_DECL_REG(1); + MZ_GC_VAR_IN_REG(0, funcname); + MZ_GC_REG(); + + /* FIXME: func_ref() and func_unref() are needed. */ + /* TODO: Support pt_dict and pt_argv. */ + funcname = scheme_make_byte_string( + (char *)vim_value->vval.v_partial->pt_name); + MZ_GC_CHECK(); + result = scheme_make_closed_prim_w_arity(vim_funcref, funcname, + (const char *)BYTE_STRING_VALUE(funcname), 0, -1); + MZ_GC_CHECK(); + + MZ_GC_UNREG(); + } + } else if (vim_value->v_type == VAR_SPECIAL) { if (vim_value->vval.v_number <= VVAL_TRUE) diff --git a/src/if_ruby.c b/src/if_ruby.c index fa06f45f6b..ac4b5f66ef 100644 --- a/src/if_ruby.c +++ b/src/if_ruby.c @@ -739,7 +739,8 @@ vim_str2rb_enc_str(const char *s) { enc = rb_enc_find((char *)sval); vim_free(sval); - if (enc) { + if (enc) + { return rb_enc_str_new(s, strlen(s), enc); } } @@ -781,19 +782,23 @@ void ex_rubydo(exarg_T *eap) { if (u_save(eap->line1 - 1, eap->line2 + 1) != OK) return; - for (i = eap->line1; i <= eap->line2; i++) { + for (i = eap->line1; i <= eap->line2; i++) + { VALUE line; line = vim_str2rb_enc_str((char *)ml_get(i)); rb_lastline_set(line); eval_enc_string_protect((char *) eap->arg, &state); - if (state) { + if (state) + { error_print(state); break; } line = rb_lastline_get(); - if (!NIL_P(line)) { - if (TYPE(line) != T_STRING) { + if (!NIL_P(line)) + { + if (TYPE(line) != T_STRING) + { EMSG(_("E265: $_ must be an instance of String")); return; } @@ -906,7 +911,8 @@ static void error_print(int state) #define TAG_FATAL 0x8 #define TAG_MASK 0xf - switch (state) { + switch (state) + { case TAG_RETURN: EMSG(_("E267: unexpected return")); break; @@ -931,10 +937,12 @@ static void error_print(int state) eclass = CLASS_OF(ruby_errinfo); einfo = rb_obj_as_string(ruby_errinfo); #endif - if (eclass == rb_eRuntimeError && RSTRING_LEN(einfo) == 0) { + if (eclass == rb_eRuntimeError && RSTRING_LEN(einfo) == 0) + { EMSG(_("E272: unhandled exception")); } - else { + else + { VALUE epath; char *p; @@ -1216,7 +1224,8 @@ static VALUE set_buffer_line(buf_T *buf, linenr_T n, VALUE str) /* set curwin/curbuf for "buf" and save some things */ aucmd_prepbuf(&aco, buf); - if (u_savesub(n) == OK) { + if (u_savesub(n) == OK) + { ml_replace(n, (char_u *)line, TRUE); changed(); #ifdef SYNTAX_HL @@ -1257,7 +1266,8 @@ static VALUE buffer_delete(VALUE self, VALUE num) /* set curwin/curbuf for "buf" and save some things */ aucmd_prepbuf(&aco, buf); - if (u_savedel(n, 1) == OK) { + if (u_savedel(n, 1) == OK) + { ml_delete(n, 0); /* Changes to non-active buffers should properly refresh @@ -1296,7 +1306,8 @@ static VALUE buffer_append(VALUE self, VALUE num, VALUE str) /* set curwin/curbuf for "buf" and save some things */ aucmd_prepbuf(&aco, buf); - if (u_inssub(n + 1) == OK) { + if (u_inssub(n + 1) == OK) + { ml_append(n, (char_u *) line, (colnr_T) 0, FALSE); /* Changes to non-active buffers should properly refresh screen @@ -1502,7 +1513,8 @@ static VALUE f_p(int argc, VALUE *argv, VALUE self UNUSED) int i; VALUE str = rb_str_new("", 0); - for (i = 0; i < argc; i++) { + for (i = 0; i < argc; i++) + { if (i > 0) rb_str_cat(str, ", ", 2); rb_str_concat(str, rb_inspect(argv[i])); } diff --git a/src/testdir/runtest.vim b/src/testdir/runtest.vim index 0cf50006db..4d75af3ee9 100644 --- a/src/testdir/runtest.vim +++ b/src/testdir/runtest.vim @@ -55,6 +55,9 @@ lang mess C " Always use forward slashes. set shellslash +" Make sure $HOME does not get read or written. +let $HOME = '/does/not/exist' + let s:srcdir = expand('%:p:h:h') " Support function: get the alloc ID by name. @@ -141,7 +144,6 @@ for s:test in sort(s:tests) call extend(s:errors, v:errors) let v:errors = [] endif - endfor if s:fail == 0 diff --git a/src/testdir/test_backspace_opt.vim b/src/testdir/test_backspace_opt.vim index f80e831e9a..7fbba96c66 100644 --- a/src/testdir/test_backspace_opt.vim +++ b/src/testdir/test_backspace_opt.vim @@ -53,7 +53,7 @@ func Test_backspace_option() " Cleared when 'compatible' is set set compatible call assert_equal('', &backspace) - set nocompatible + set nocompatible viminfo+=nviminfo endfunc " vim: tabstop=2 shiftwidth=0 expandtab diff --git a/src/testdir/test_channel.vim b/src/testdir/test_channel.vim index 5e34ad2ca1..119f71a355 100644 --- a/src/testdir/test_channel.vim +++ b/src/testdir/test_channel.vim @@ -1203,6 +1203,29 @@ func Test_close_callback() call s:run_server('s:test_close_callback') endfunc +function s:test_close_partial(port) + let handle = ch_open('localhost:' . a:port, s:chopt) + if ch_status(handle) == "fail" + call assert_false(1, "Can't open channel") + return + endif + let s:d = {} + func s:d.closeCb(ch) dict + let self.close_ret = 'closed' + endfunc + call ch_setoptions(handle, {'close_cb': s:d.closeCb}) + + call assert_equal('', ch_evalexpr(handle, 'close me')) + call s:waitFor('"closed" == s:d.close_ret') + call assert_equal('closed', s:d.close_ret) + unlet s:d +endfunc + +func Test_close_partial() + call ch_log('Test_close_partial()') + call s:run_server('s:test_close_partial') +endfunc + func Test_job_start_invalid() call assert_fails('call job_start($x)', 'E474:') call assert_fails('call job_start("")', 'E474:') diff --git a/src/testdir/test_viminfo.vim b/src/testdir/test_viminfo.vim index 3efe75e826..a979ab9967 100644 --- a/src/testdir/test_viminfo.vim +++ b/src/testdir/test_viminfo.vim @@ -36,7 +36,7 @@ func Test_global_vars() " store a really long list, so line wrapping will occur in viminfo file let test_list = range(1,100) let g:MY_GLOBAL_LIST = test_list - set viminfo='100,<50,s10,h,! + set viminfo='100,<50,s10,h,!,nviminfo wv! Xviminfo unlet g:MY_GLOBAL_DICT unlet g:MY_GLOBAL_LIST diff --git a/src/version.c b/src/version.c index 1d2e28a89c..b78e0eaa51 100644 --- a/src/version.c +++ b/src/version.c @@ -763,6 +763,14 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1689, +/**/ + 1688, +/**/ + 1687, +/**/ + 1686, /**/ 1685, /**/