diff src/quickfix.c @ 26175:6b4f017d7005 v8.2.3619

patch 8.2.3619: cannot use a lambda for 'operatorfunc' Commit: https://github.com/vim/vim/commit/777175b0df8c5ec3cd30d19a2e887e661ac209c8 Author: Yegappan Lakshmanan <yegappan@yahoo.com> Date: Thu Nov 18 22:08:57 2021 +0000 patch 8.2.3619: cannot use a lambda for 'operatorfunc' Problem: Cannot use a lambda for 'operatorfunc'. Solution: Support using a lambda or partial. (Yegappan Lakshmanan, closes #8775)
author Bram Moolenaar <Bram@vim.org>
date Thu, 18 Nov 2021 23:15:04 +0100
parents db9fdfb86679
children baf0d27eb024
line wrap: on
line diff
--- 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);
 }
 
 /*