split(",,,x,,,", ",") returns ["x", "", ""]. I think expected result is ["x"].
diff --git a/src/eval.c b/src/eval.c index 3650c34..e5fd5cf 100644 --- a/src/eval.c +++ b/src/eval.c @@ -18291,6 +18291,14 @@ f_split(argvars, rettv) vim_regfree(regmatch.regprog); } + if (!keepempty) + { + while (rettv->vval.v_list->lv_len > 0 + && rettv->vval.v_list->lv_last->li_tv.vval.v_string[0] == NUL) + vimlist_remove(rettv->vval.v_list, rettv->vval.v_list->lv_last, + rettv->vval.v_list->lv_last); + } + p_cpo = save_cpo; } Anyway, is it possible to change split()'s behavior to omit all empty field (split(",,,x,,,y,,,") => ["x", "y"])? I don't have a problem with this. But I thought that the current omitting behavior is a bit strange. -- Yukihiro Nakadaira - yukihiro.nakada...@gmail.com -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.