Mercurial > vim
comparison src/cmdexpand.c @ 26213:ee1c116b91ea v8.2.3638
patch 8.2.3638: getcompletion() always passes zero as position
Commit: https://github.com/vim/vim/commit/4785fe02bba14c4e0aede0fa425ca790a1cb98d7
Author: ii14 <ii14@users.noreply.github.com>
Date: Sun Nov 21 12:13:56 2021 +0000
patch 8.2.3638: getcompletion() always passes zero as position
Problem: getcompletion() always passes zero as position to custom
completion function.
Solution: Pass the pattern length. (closes #9173)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 21 Nov 2021 13:15:04 +0100 |
parents | 162ef12a3b5f |
children | ef0c07cbf53f |
comparison
equal
deleted
inserted
replaced
26212:f9092e65ea98 | 26213:ee1c116b91ea |
---|---|
2898 && (check_for_string_arg(argvars, 0) == FAIL | 2898 && (check_for_string_arg(argvars, 0) == FAIL |
2899 || check_for_string_arg(argvars, 1) == FAIL | 2899 || check_for_string_arg(argvars, 1) == FAIL |
2900 || check_for_opt_bool_arg(argvars, 2) == FAIL)) | 2900 || check_for_opt_bool_arg(argvars, 2) == FAIL)) |
2901 return; | 2901 return; |
2902 | 2902 |
2903 pat = tv_get_string(&argvars[0]); | |
2903 if (argvars[1].v_type != VAR_STRING) | 2904 if (argvars[1].v_type != VAR_STRING) |
2904 { | 2905 { |
2905 semsg(_(e_invarg2), "type must be a string"); | 2906 semsg(_(e_invarg2), "type must be a string"); |
2906 return; | 2907 return; |
2907 } | 2908 } |
2918 options |= WILD_KEEP_ALL; | 2919 options |= WILD_KEEP_ALL; |
2919 | 2920 |
2920 ExpandInit(&xpc); | 2921 ExpandInit(&xpc); |
2921 if (STRCMP(type, "cmdline") == 0) | 2922 if (STRCMP(type, "cmdline") == 0) |
2922 { | 2923 { |
2923 set_one_cmd_context(&xpc, tv_get_string(&argvars[0])); | 2924 set_one_cmd_context(&xpc, pat); |
2924 xpc.xp_pattern_len = (int)STRLEN(xpc.xp_pattern); | 2925 xpc.xp_pattern_len = (int)STRLEN(xpc.xp_pattern); |
2926 xpc.xp_col = (int)STRLEN(pat); | |
2925 } | 2927 } |
2926 else | 2928 else |
2927 { | 2929 { |
2928 xpc.xp_pattern = tv_get_string(&argvars[0]); | 2930 xpc.xp_pattern = pat; |
2929 xpc.xp_pattern_len = (int)STRLEN(xpc.xp_pattern); | 2931 xpc.xp_pattern_len = (int)STRLEN(xpc.xp_pattern); |
2930 | 2932 |
2931 xpc.xp_context = cmdcomplete_str_to_type(type); | 2933 xpc.xp_context = cmdcomplete_str_to_type(type); |
2932 if (xpc.xp_context == EXPAND_NOTHING) | 2934 if (xpc.xp_context == EXPAND_NOTHING) |
2933 { | 2935 { |