comparison src/evalfunc.c @ 16833:6699c03347d2 v8.1.1418

patch 8.1.1418: win_execute() is not implemented yet commit https://github.com/vim/vim/commit/868b7b6712ea4f2232eeeae18c5cbbbddf2ee84d Author: Bram Moolenaar <Bram@vim.org> Date: Wed May 29 21:44:40 2019 +0200 patch 8.1.1418: win_execute() is not implemented yet Problem: Win_execute() is not implemented yet. Solution: Implement it.
author Bram Moolenaar <Bram@vim.org>
date Wed, 29 May 2019 21:45:05 +0200
parents 5cebaecad422
children cf630fab9fb6
comparison
equal deleted inserted replaced
16832:74537e143a88 16833:6699c03347d2
490 static void f_uniq(typval_T *argvars, typval_T *rettv); 490 static void f_uniq(typval_T *argvars, typval_T *rettv);
491 static void f_values(typval_T *argvars, typval_T *rettv); 491 static void f_values(typval_T *argvars, typval_T *rettv);
492 static void f_virtcol(typval_T *argvars, typval_T *rettv); 492 static void f_virtcol(typval_T *argvars, typval_T *rettv);
493 static void f_visualmode(typval_T *argvars, typval_T *rettv); 493 static void f_visualmode(typval_T *argvars, typval_T *rettv);
494 static void f_wildmenumode(typval_T *argvars, typval_T *rettv); 494 static void f_wildmenumode(typval_T *argvars, typval_T *rettv);
495 static void f_win_execute(typval_T *argvars, typval_T *rettv);
495 static void f_win_findbuf(typval_T *argvars, typval_T *rettv); 496 static void f_win_findbuf(typval_T *argvars, typval_T *rettv);
496 static void f_win_getid(typval_T *argvars, typval_T *rettv); 497 static void f_win_getid(typval_T *argvars, typval_T *rettv);
497 static void f_win_gotoid(typval_T *argvars, typval_T *rettv); 498 static void f_win_gotoid(typval_T *argvars, typval_T *rettv);
498 static void f_win_id2tabwin(typval_T *argvars, typval_T *rettv); 499 static void f_win_id2tabwin(typval_T *argvars, typval_T *rettv);
499 static void f_win_id2win(typval_T *argvars, typval_T *rettv); 500 static void f_win_id2win(typval_T *argvars, typval_T *rettv);
1043 {"uniq", 1, 3, f_uniq}, 1044 {"uniq", 1, 3, f_uniq},
1044 {"values", 1, 1, f_values}, 1045 {"values", 1, 1, f_values},
1045 {"virtcol", 1, 1, f_virtcol}, 1046 {"virtcol", 1, 1, f_virtcol},
1046 {"visualmode", 0, 1, f_visualmode}, 1047 {"visualmode", 0, 1, f_visualmode},
1047 {"wildmenumode", 0, 0, f_wildmenumode}, 1048 {"wildmenumode", 0, 0, f_wildmenumode},
1049 {"win_execute", 2, 3, f_win_execute},
1048 {"win_findbuf", 1, 1, f_win_findbuf}, 1050 {"win_findbuf", 1, 1, f_win_findbuf},
1049 {"win_getid", 0, 2, f_win_getid}, 1051 {"win_getid", 0, 2, f_win_getid},
1050 {"win_gotoid", 1, 1, f_win_gotoid}, 1052 {"win_gotoid", 1, 1, f_win_gotoid},
1051 {"win_id2tabwin", 1, 1, f_win_id2tabwin}, 1053 {"win_id2tabwin", 1, 1, f_win_id2tabwin},
1052 {"win_id2win", 1, 1, f_win_id2win}, 1054 {"win_id2win", 1, 1, f_win_id2win},
3517 3519
3518 /* 3520 /*
3519 * "execute()" function 3521 * "execute()" function
3520 */ 3522 */
3521 static void 3523 static void
3522 f_execute(typval_T *argvars, typval_T *rettv) 3524 execute_common(typval_T *argvars, typval_T *rettv, int arg_off)
3523 { 3525 {
3524 char_u *cmd = NULL; 3526 char_u *cmd = NULL;
3525 list_T *list = NULL; 3527 list_T *list = NULL;
3526 int save_msg_silent = msg_silent; 3528 int save_msg_silent = msg_silent;
3527 int save_emsg_silent = emsg_silent; 3529 int save_emsg_silent = emsg_silent;
3533 int echo_output = FALSE; 3535 int echo_output = FALSE;
3534 3536
3535 rettv->vval.v_string = NULL; 3537 rettv->vval.v_string = NULL;
3536 rettv->v_type = VAR_STRING; 3538 rettv->v_type = VAR_STRING;
3537 3539
3538 if (argvars[0].v_type == VAR_LIST) 3540 if (argvars[arg_off].v_type == VAR_LIST)
3539 { 3541 {
3540 list = argvars[0].vval.v_list; 3542 list = argvars[arg_off].vval.v_list;
3541 if (list == NULL || list->lv_first == NULL) 3543 if (list == NULL || list->lv_first == NULL)
3542 /* empty list, no commands, empty output */ 3544 /* empty list, no commands, empty output */
3543 return; 3545 return;
3544 ++list->lv_refcount; 3546 ++list->lv_refcount;
3545 } 3547 }
3546 else 3548 else
3547 { 3549 {
3548 cmd = tv_get_string_chk(&argvars[0]); 3550 cmd = tv_get_string_chk(&argvars[arg_off]);
3549 if (cmd == NULL) 3551 if (cmd == NULL)
3550 return; 3552 return;
3551 } 3553 }
3552 3554
3553 if (argvars[1].v_type != VAR_UNKNOWN) 3555 if (argvars[arg_off + 1].v_type != VAR_UNKNOWN)
3554 { 3556 {
3555 char_u buf[NUMBUFLEN]; 3557 char_u buf[NUMBUFLEN];
3556 char_u *s = tv_get_string_buf_chk(&argvars[1], buf); 3558 char_u *s = tv_get_string_buf_chk(&argvars[arg_off + 1], buf);
3557 3559
3558 if (s == NULL) 3560 if (s == NULL)
3559 return; 3561 return;
3560 if (*s == NUL) 3562 if (*s == NUL)
3561 echo_output = TRUE; 3563 echo_output = TRUE;
3616 msg_col = 0; 3618 msg_col = 0;
3617 else 3619 else
3618 // When working silently: Put it back where it was, since nothing 3620 // When working silently: Put it back where it was, since nothing
3619 // should have been written. 3621 // should have been written.
3620 msg_col = save_msg_col; 3622 msg_col = save_msg_col;
3623 }
3624
3625 /*
3626 * "execute()" function
3627 */
3628 static void
3629 f_execute(typval_T *argvars, typval_T *rettv)
3630 {
3631 execute_common(argvars, rettv, 0);
3621 } 3632 }
3622 3633
3623 /* 3634 /*
3624 * "exepath()" function 3635 * "exepath()" function
3625 */ 3636 */
6090 if (d != NULL) 6101 if (d != NULL)
6091 list_append_dict(rettv->vval.v_list, d); 6102 list_append_dict(rettv->vval.v_list, d);
6092 if (wparg != NULL) 6103 if (wparg != NULL)
6093 /* found information about a specific window */ 6104 /* found information about a specific window */
6094 return; 6105 return;
6106 }
6107 }
6108 }
6109
6110 /*
6111 * "win_execute()" function
6112 */
6113 static void
6114 f_win_execute(typval_T *argvars, typval_T *rettv)
6115 {
6116 int id = (int)tv_get_number(argvars);
6117 win_T *wp = win_id2wp(id);
6118 win_T *save_curwin = curwin;
6119
6120 if (wp != NULL)
6121 {
6122 curwin = wp;
6123 curbuf = curwin->w_buffer;
6124 check_cursor();
6125 execute_common(argvars, rettv, 1);
6126 if (win_valid(save_curwin))
6127 {
6128 curwin = save_curwin;
6129 curbuf = curwin->w_buffer;
6095 } 6130 }
6096 } 6131 }
6097 } 6132 }
6098 6133
6099 /* 6134 /*