diff options
author | Yegappan Lakshmanan <yegappan@yahoo.com> | 2021-11-18 22:08:57 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-11-18 22:08:57 +0000 |
commit | 777175b0df8c5ec3cd30d19a2e887e661ac209c8 (patch) | |
tree | 58806429ad4998391464a42f4f4321779642bd2a /src/quickfix.c | |
parent | 851c7a699ae00bdc14a4db874cf722b7b7393b53 (diff) | |
download | vim-git-777175b0df8c5ec3cd30d19a2e887e661ac209c8.tar.gz |
patch 8.2.3619: cannot use a lambda for 'operatorfunc'v8.2.3619
Problem: Cannot use a lambda for 'operatorfunc'.
Solution: Support using a lambda or partial. (Yegappan Lakshmanan,
closes #8775)
Diffstat (limited to 'src/quickfix.c')
-rw-r--r-- | src/quickfix.c | 37 |
1 files changed, 2 insertions, 35 deletions
diff --git a/src/quickfix.c b/src/quickfix.c index 3fb921ff2..4405d4b64 100644 --- a/src/quickfix.c +++ b/src/quickfix.c @@ -4437,45 +4437,12 @@ qf_find_buf(qf_info_T *qi) /* * Process the 'quickfixtextfunc' option value. + * Returns OK or FAIL. */ int qf_process_qftf_option(void) { - typval_T *tv; - callback_T cb; - - if (p_qftf == NULL || *p_qftf == NUL) - { - free_callback(&qftf_cb); - return TRUE; - } - - if (*p_qftf == '{') - { - // Lambda expression - tv = eval_expr(p_qftf, NULL); - if (tv == NULL) - return FALSE; - } - else - { - // treat everything else as a function name string - tv = alloc_string_tv(vim_strsave(p_qftf)); - if (tv == NULL) - return FALSE; - } - - cb = get_callback(tv); - if (cb.cb_name == NULL) - { - free_tv(tv); - return FALSE; - } - - free_callback(&qftf_cb); - set_callback(&qftf_cb, &cb); - free_tv(tv); - return TRUE; + return option_set_callback_func(p_qftf, &qftf_cb); } /* |