Skip to content

Args and tail comments break text-input command parsing in functions - #21346

Draft
dkearns wants to merge 1 commit into
vim:masterfrom
dkearns:fix-function-body-text-input-command-parsing
Draft

dkearns wants to merge 1 commit into
vim:masterfrom
dkearns:fix-function-body-text-input-command-parsing

Conversation

@dkearns

@dkearns dkearns commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

Problem: Args and tail comments break text-input command parsing in
functions (after v9.1.1607).
Solution: Remove the incorrect trailing-text check and only match the
command name, as was done before v9.1.1607.

Parsing of text-input commands, with count arguments or trailing
comments, in function bodies has been broken since v9.1.1607. The
command's input lines are then parsed as function-body commands.

This removes the partial attempt at argument parsing introduced in the
referenced patch. Attempting to validate the arguments to these
text-input commands is atypical for get_function_body() which only does
enough work to allow for the function's closing command to be
successfully identified. Otherwise, it simply slurps its body commands.

Remove useless/misplaced/duplicate tests.

related: #17893

This is a simple fix I managed to dig up and split off from a more
comprehensive refactoring of get_function_body() that fell by the wayside
after 9.1.1607. I'll also split off a followup to fix the same original bug in
heredoc parsing rather than complicate this 'reversion'.

Problem:  Args and tail comments break text-input command parsing in
          functions (after v9.1.1607).
Solution: Remove the incorrect trailing-text check and only match the
          command name, as was done before v9.1.1607.

Parsing of text-input commands, with count arguments or trailing
comments, in function bodies has been broken since v9.1.1607.  The
command's input lines are then parsed as function-body commands.

This removes the partial attempt at argument parsing introduced in the
referenced patch.  Attempting to validate the arguments to these
text-input commands is atypical for get_function_body() which only does
enough work to allow for the function's closing command to be
successfully identified.  Otherwise, it simply slurps its body commands.

Remove useless/misplaced/duplicate tests.

related: vim#17893

Signed-off-by: Doug Kearns <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant