Sean Ma wrote:
> When leading zero is included, an unexpected Octal conversion is used.
> This might be a "bug" instead of a "feature".
>
> >From the help, we have:
>
> FUNCTIONS FOR FINDING COMPLETIONS *complete-functions*
> ...
> On the second invocation the arguments are:
> a:base the text with which matches should match; the text that
> was
> located in the first call (can be empty)
>
> Therefore, a:base should be "text", as it is.
>
> However, when "text" including leading zero, auto Octal conversion is
> done.
> For example: when input is 0123, output is 83, instead of '0123'.
>
> My workaround from the script level is to use my self-made s:base
> variable,
> instead of using a:base function argument:
>
> let current_line = getline(line('.'))
> let start_cursor = col('.')-1
> " start_column is what found from the first invocation
>
> let len = start_cursor - start_column
> let s:base = strpart(current_line, start_column, len)
>
> In this example, when input is '0123':
> s:base returns '0123' (expected)
> a:base returns '83' (surprise!)
I see the problem. When calling the function recognizing a number
argument is automatically done, so everything that starts with a digit
is assumed to be a number.
--
There is no right or wrong, there is only your personal opinion.
(Bram Moolenaar)
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ download, build and distribute -- http://www.A-A-P.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---