Groups
Groups
Sign in
Groups
Groups
vim_dev
Conversations
About
Send feedback
Help
Possible bug in pattern processing for try/catch blocks
10 views
Skip to first unread message
Jason Franklin
unread,
Oct 24, 2020, 11:15:35 AM
10/24/20
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to vim-dev
Greetings:
I have discovered that the pattern matching in try/catch blocks does not
conform to my expectations.
Try this example:
try
echoerr 'foo bar baz'
catch /foo/
echo 'caught'
endtry
The string "caught" is printed, as I would expect.
Now try this:
try
echoerr 'foo bar baz'
catch /^foo/
echo 'caught'
endtry
You will see that the message was NOT caught. It appears that using the
"^" metacharacter here causes the message not to match.
Can anyone else confirm this? Is this a bug?
It definitely surprised me.
--
Jason Franklin
Yegappan Lakshmanan
unread,
Oct 24, 2020, 11:55:35 AM
10/24/20
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to vim_dev, vim-dev
Hi,
The exception that is thrown is "Vim(echoerr):foo bar baz". So if you want to
match the beginning of the exception string, then you need to
use /^Vim(echoerr):foo/
- Yegappan
Reply all
Reply to author
Forward
0 new messages