comparison src/vim9execute.c @ 19528:3b026343f398 v8.2.0321

patch 8.2.0321: Vim9: ":execute" does not work yet Commit: https://github.com/vim/vim/commit/ad39c094d261109a695aba2c4f19fe336736cc55 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Feb 26 18:23:43 2020 +0100 patch 8.2.0321: Vim9: ":execute" does not work yet Problem: Vim9: ":execute" does not work yet. Solution: Add ISN_EXECUTE. (closes https://github.com/vim/vim/issues/5699) Also make :echo work with more than one argument.
author Bram Moolenaar <Bram@vim.org>
date Wed, 26 Feb 2020 18:30:04 +0100
parents 798fce18d049
children b8f778dda1a1
comparison
equal deleted inserted replaced
19527:b4e703999a84 19528:3b026343f398
528 clear_tv(tv); 528 clear_tv(tv);
529 } 529 }
530 if (needclr) 530 if (needclr)
531 msg_clr_eos(); 531 msg_clr_eos();
532 ectx.ec_stack.ga_len -= count; 532 ectx.ec_stack.ga_len -= count;
533 }
534 break;
535
536 // execute :execute {string} ...
537 case ISN_EXECUTE:
538 {
539 int count = iptr->isn_arg.number;
540 garray_T ga;
541 char_u buf[NUMBUFLEN];
542 char_u *p;
543 int len;
544 int failed = FALSE;
545
546 ga_init2(&ga, 1, 80);
547 for (idx = 0; idx < count; ++idx)
548 {
549 tv = STACK_TV_BOT(idx - count);
550 if (tv->v_type == VAR_CHANNEL || tv->v_type == VAR_JOB)
551 {
552 emsg(_(e_inval_string));
553 break;
554 }
555 else
556 p = tv_get_string_buf(tv, buf);
557
558 len = (int)STRLEN(p);
559 if (ga_grow(&ga, len + 2) == FAIL)
560 failed = TRUE;
561 else
562 {
563 if (ga.ga_len > 0)
564 ((char_u *)(ga.ga_data))[ga.ga_len++] = ' ';
565 STRCPY((char_u *)(ga.ga_data) + ga.ga_len, p);
566 ga.ga_len += len;
567 }
568 clear_tv(tv);
569 }
570 ectx.ec_stack.ga_len -= count;
571
572 if (!failed && ga.ga_data != NULL)
573 do_cmdline_cmd((char_u *)ga.ga_data);
574 ga_clear(&ga);
533 } 575 }
534 break; 576 break;
535 577
536 // load local variable or argument 578 // load local variable or argument
537 case ISN_LOAD: 579 case ISN_LOAD:
1663 1705
1664 smsg("%4d %s %d", current, 1706 smsg("%4d %s %d", current,
1665 echo->echo_with_white ? "ECHO" : "ECHON", 1707 echo->echo_with_white ? "ECHO" : "ECHON",
1666 echo->echo_count); 1708 echo->echo_count);
1667 } 1709 }
1710 break;
1711 case ISN_EXECUTE:
1712 smsg("%4d EXECUTE %d", current, iptr->isn_arg.number);
1668 break; 1713 break;
1669 case ISN_LOAD: 1714 case ISN_LOAD:
1670 if (iptr->isn_arg.number < 0) 1715 if (iptr->isn_arg.number < 0)
1671 smsg("%4d LOAD arg[%lld]", current, 1716 smsg("%4d LOAD arg[%lld]", current,
1672 iptr->isn_arg.number + STACK_FRAME_SIZE); 1717 iptr->isn_arg.number + STACK_FRAME_SIZE);