Mercurial > vim
comparison src/ex_docmd.c @ 20079:336483164ca6 v8.2.0595
patch 8.2.0595: Vim9: not all commands using ends_excmd() tested
Commit: https://github.com/vim/vim/commit/a26b9700d73ebccd6c5459d0d66032a4249f6b72
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Apr 18 19:53:28 2020 +0200
patch 8.2.0595: Vim9: not all commands using ends_excmd() tested
Problem: Vim9: not all commands using ends_excmd() tested.
Solution: Find # comment after regular commands. Add more tests. Report
error for where it was caused.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 18 Apr 2020 20:00:04 +0200 |
parents | 516b10943fdb |
children | 165ec447ca77 |
comparison
equal
deleted
inserted
replaced
20078:61222b5d173d | 20079:336483164ca6 |
---|---|
1834 * If we got a line, but no command, then go to the line. | 1834 * If we got a line, but no command, then go to the line. |
1835 * If we find a '|' or '\n' we set ea.nextcmd. | 1835 * If we find a '|' or '\n' we set ea.nextcmd. |
1836 */ | 1836 */ |
1837 if (*ea.cmd == NUL || *ea.cmd == '"' | 1837 if (*ea.cmd == NUL || *ea.cmd == '"' |
1838 #ifdef FEAT_EVAL | 1838 #ifdef FEAT_EVAL |
1839 || (*ea.cmd == '#' && !starts_with_colon && in_vim9script()) | 1839 || (*ea.cmd == '#' && ea.cmd[1] != '{' |
1840 && !starts_with_colon && in_vim9script()) | |
1840 #endif | 1841 #endif |
1841 || (ea.nextcmd = check_nextcmd(ea.cmd)) != NULL) | 1842 || (ea.nextcmd = check_nextcmd(ea.cmd)) != NULL) |
1842 { | 1843 { |
1843 /* | 1844 /* |
1844 * strange vi behaviour: | 1845 * strange vi behaviour: |
4434 else if ((*p == '"' && !(eap->argt & EX_NOTRLCOM) | 4435 else if ((*p == '"' && !(eap->argt & EX_NOTRLCOM) |
4435 && ((eap->cmdidx != CMD_at && eap->cmdidx != CMD_star) | 4436 && ((eap->cmdidx != CMD_at && eap->cmdidx != CMD_star) |
4436 || p != eap->arg) | 4437 || p != eap->arg) |
4437 && (eap->cmdidx != CMD_redir | 4438 && (eap->cmdidx != CMD_redir |
4438 || p != eap->arg + 1 || p[-1] != '@')) | 4439 || p != eap->arg + 1 || p[-1] != '@')) |
4440 #ifdef FEAT_EVAL | |
4441 || (*p == '#' && in_vim9script() | |
4442 && p[1] != '{' && p > eap->cmd && VIM_ISWHITE(p[-1])) | |
4443 #endif | |
4439 || *p == '|' || *p == '\n') | 4444 || *p == '|' || *p == '\n') |
4440 { | 4445 { |
4441 /* | 4446 /* |
4442 * We remove the '\' before the '|', unless EX_CTRLV is used | 4447 * We remove the '\' before the '|', unless EX_CTRLV is used |
4443 * AND 'b' is present in 'cpoptions'. | 4448 * AND 'b' is present in 'cpoptions'. |
4788 ends_excmd2(char_u *cmd_start UNUSED, char_u *cmd) | 4793 ends_excmd2(char_u *cmd_start UNUSED, char_u *cmd) |
4789 { | 4794 { |
4790 int c = *cmd; | 4795 int c = *cmd; |
4791 | 4796 |
4792 #ifdef FEAT_EVAL | 4797 #ifdef FEAT_EVAL |
4793 if (c == '#' && (cmd == cmd_start || VIM_ISWHITE(cmd[-1]))) | 4798 if (c == '#' && cmd[1] != '{' && (cmd == cmd_start || VIM_ISWHITE(cmd[-1]))) |
4794 return in_vim9script(); | 4799 return in_vim9script(); |
4795 #endif | 4800 #endif |
4796 return (c == NUL || c == '|' || c == '"' || c == '\n'); | 4801 return (c == NUL || c == '|' || c == '"' || c == '\n'); |
4797 } | 4802 } |
4798 | 4803 |