Mercurial > vim
comparison src/ex_docmd.c @ 22772:82a7aff951d2 v8.2.1934
patch 8.2.1934: Vim9: command modifiers in :def function not tested
Commit: https://github.com/vim/vim/commit/e88c8e802cf5ee59a2a6649a5b46c9e80de823ad
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Nov 1 17:03:37 2020 +0100
patch 8.2.1934: Vim9: command modifiers in :def function not tested
Problem: Vim9: command modifiers in :def function not tested.
Solution: Add tests. Fix using modifier before filter command.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 01 Nov 2020 17:15:06 +0100 |
parents | f945413264d7 |
children | 44317eb799d7 |
comparison
equal
deleted
inserted
replaced
22771:84263588f5be | 22772:82a7aff951d2 |
---|---|
1780 * | 1780 * |
1781 * We need the command to know what kind of range it uses. | 1781 * We need the command to know what kind of range it uses. |
1782 */ | 1782 */ |
1783 cmd = ea.cmd; | 1783 cmd = ea.cmd; |
1784 #ifdef FEAT_EVAL | 1784 #ifdef FEAT_EVAL |
1785 // In Vim9 script a colon is required before the range. | 1785 // In Vim9 script a colon is required before the range. This may also be |
1786 may_have_range = !vim9script || starts_with_colon; | 1786 // after command modifiers. |
1787 if (vim9script) | |
1788 { | |
1789 may_have_range = FALSE; | |
1790 for (p = ea.cmd; p >= *cmdlinep; --p) | |
1791 { | |
1792 if (*p == ':') | |
1793 may_have_range = TRUE; | |
1794 if (p < ea.cmd && !VIM_ISWHITE(*p)) | |
1795 break; | |
1796 } | |
1797 } | |
1798 else | |
1799 may_have_range = TRUE; | |
1787 if (may_have_range) | 1800 if (may_have_range) |
1788 #endif | 1801 #endif |
1789 ea.cmd = skip_range(ea.cmd, TRUE, NULL); | 1802 ea.cmd = skip_range(ea.cmd, TRUE, NULL); |
1790 | 1803 |
1791 #ifdef FEAT_EVAL | 1804 #ifdef FEAT_EVAL |
1792 if (vim9script && !starts_with_colon) | 1805 if (vim9script && !may_have_range) |
1793 { | 1806 { |
1794 if (ea.cmd == cmd + 1 && *cmd == '$') | 1807 if (ea.cmd == cmd + 1 && *cmd == '$') |
1795 // should be "$VAR = val" | 1808 // should be "$VAR = val" |
1796 --ea.cmd; | 1809 --ea.cmd; |
1797 else if (ea.cmd > cmd) | 1810 else if (ea.cmd > cmd) |