diff options
author | ZyX <kp-pav@yandex.ru> | 2017-07-01 15:34:25 +0300 |
---|---|---|
committer | ZyX <kp-pav@yandex.ru> | 2017-07-01 15:34:25 +0300 |
commit | 7ab152aaa58f493e54d03a15960b8a288196e588 (patch) | |
tree | 98bdee4ca0c37d1b71b70fe0db4fedb3c4ef1f64 /src/nvim/api/private/helpers.h | |
parent | ea75966e4232dc4a3693cbc4a572f2116c49b138 (diff) | |
download | rneovim-7ab152aaa58f493e54d03a15960b8a288196e588.tar.gz rneovim-7ab152aaa58f493e54d03a15960b8a288196e588.tar.bz2 rneovim-7ab152aaa58f493e54d03a15960b8a288196e588.zip |
ex_getln: Save and restore try state
Problem: when processing cycle such as
:for pat in [' \ze*', ' \zs*']
: try
: let l = matchlist('x x', pat)
: $put ='E888 NOT detected for ' . pat
: catch
: $put ='E888 detected for ' . pat
: endtry
:endfor
`:let l = …` throwing an error causes this error to be caught after
color_cmdline attempts to get callback for highlighting next line (the one with
`$put = 'E888 NOT…`). Saving/restoring state prevents this from happening.
Diffstat (limited to 'src/nvim/api/private/helpers.h')
-rw-r--r-- | src/nvim/api/private/helpers.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/nvim/api/private/helpers.h b/src/nvim/api/private/helpers.h index 159b9d5c2a..112d785bfd 100644 --- a/src/nvim/api/private/helpers.h +++ b/src/nvim/api/private/helpers.h @@ -82,6 +82,18 @@ #define api_free_window(value) #define api_free_tabpage(value) +/// Structure used for saving state for :try +/// +/// Used when caller is supposed to be operating when other VimL code is being +/// processed and that “other VimL code” must not be affected. +typedef struct { + int trylevel; + int got_int; + int did_throw; + struct msglist *private_msg_list; + const struct msglist *const *msg_list; +} TryState; + #ifdef INCLUDE_GENERATED_DECLARATIONS # include "api/private/helpers.h.generated.h" #endif |