comparison src/undo.c @ 17970:684a15da9929 v8.1.1981

patch 8.1.1981: the evalfunc.c file is too big Commit: https://github.com/vim/vim/commit/08c308aeb5e7dfa18fa61f261b0bff79517a4883 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Sep 4 17:48:15 2019 +0200 patch 8.1.1981: the evalfunc.c file is too big Problem: The evalfunc.c file is too big. Solution: Move undo functions to undo.c. Move cmdline functions to ex_getln.c. Move some container functions to list.c.
author Bram Moolenaar <Bram@vim.org>
date Wed, 04 Sep 2019 18:00:03 +0200
parents 0f7ae8010787
children d19caa851682
comparison
equal deleted inserted replaced
17969:bfc33cda9075 17970:684a15da9929
3570 { 3570 {
3571 return bufIsChanged(curbuf); 3571 return bufIsChanged(curbuf);
3572 } 3572 }
3573 3573
3574 #if defined(FEAT_EVAL) || defined(PROTO) 3574 #if defined(FEAT_EVAL) || defined(PROTO)
3575
3575 /* 3576 /*
3576 * For undotree(): Append the list of undo blocks at "first_uhp" to "list". 3577 * For undotree(): Append the list of undo blocks at "first_uhp" to "list".
3577 * Recursive. 3578 * Recursive.
3578 */ 3579 */
3579 void 3580 void
3610 3611
3611 list_append_dict(list, dict); 3612 list_append_dict(list, dict);
3612 uhp = uhp->uh_prev.ptr; 3613 uhp = uhp->uh_prev.ptr;
3613 } 3614 }
3614 } 3615 }
3615 #endif 3616
3617 /*
3618 * "undofile(name)" function
3619 */
3620 void
3621 f_undofile(typval_T *argvars UNUSED, typval_T *rettv)
3622 {
3623 rettv->v_type = VAR_STRING;
3624 #ifdef FEAT_PERSISTENT_UNDO
3625 {
3626 char_u *fname = tv_get_string(&argvars[0]);
3627
3628 if (*fname == NUL)
3629 {
3630 /* If there is no file name there will be no undo file. */
3631 rettv->vval.v_string = NULL;
3632 }
3633 else
3634 {
3635 char_u *ffname = FullName_save(fname, TRUE);
3636
3637 if (ffname != NULL)
3638 rettv->vval.v_string = u_get_undo_file_name(ffname, FALSE);
3639 vim_free(ffname);
3640 }
3641 }
3642 #else
3643 rettv->vval.v_string = NULL;
3644 #endif
3645 }
3646
3647 /*
3648 * "undotree()" function
3649 */
3650 void
3651 f_undotree(typval_T *argvars UNUSED, typval_T *rettv)
3652 {
3653 if (rettv_dict_alloc(rettv) == OK)
3654 {
3655 dict_T *dict = rettv->vval.v_dict;
3656 list_T *list;
3657
3658 dict_add_number(dict, "synced", (long)curbuf->b_u_synced);
3659 dict_add_number(dict, "seq_last", curbuf->b_u_seq_last);
3660 dict_add_number(dict, "save_last", (long)curbuf->b_u_save_nr_last);
3661 dict_add_number(dict, "seq_cur", curbuf->b_u_seq_cur);
3662 dict_add_number(dict, "time_cur", (long)curbuf->b_u_time_cur);
3663 dict_add_number(dict, "save_cur", (long)curbuf->b_u_save_nr_cur);
3664
3665 list = list_alloc();
3666 if (list != NULL)
3667 {
3668 u_eval_tree(curbuf->b_u_oldhead, list);
3669 dict_add_list(dict, "entries", list);
3670 }
3671 }
3672 }
3673
3674 #endif