Fix #287: Label numbers during omnicomplete
This commit is contained in:
parent
6fe6bac1a4
commit
c387b63de6
@ -387,17 +387,16 @@ endfunction
|
||||
|
||||
" }}}1
|
||||
function! s:labels_parse_number(num_tree) " {{{1
|
||||
if len(a:num_tree) == 0
|
||||
return '-'
|
||||
elseif len(a:num_tree) == 1
|
||||
if type(a:num_tree) == type([])
|
||||
return s:labels_parse_number(a:num_tree[0])
|
||||
if type(a:num_tree) == type([])
|
||||
if len(a:num_tree) == 0
|
||||
return '-'
|
||||
else
|
||||
let l:num = str2nr(a:num_tree[0])
|
||||
return l:num > 0 ? l:num : '-'
|
||||
let l:index = len(a:num_tree) == 1 ? 0 : 1
|
||||
return s:labels_parse_number(a:num_tree[l:index])
|
||||
endif
|
||||
else
|
||||
return s:labels_parse_number(a:num_tree[1])
|
||||
let l:num = str2nr(a:num_tree)
|
||||
return l:num > 0 ? l:num : '-'
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
@ -18,4 +18,54 @@ To test label completion you need to compile the document first!
|
||||
|
||||
\input{"sub3\space with\space spaces"}
|
||||
|
||||
\begin{equation}
|
||||
\label{eq:test1}
|
||||
f(x) = 1
|
||||
\end{equation}
|
||||
|
||||
\begin{equation}
|
||||
\label{eq:test2}
|
||||
f(x) = 2
|
||||
\end{equation}
|
||||
|
||||
\begin{equation}
|
||||
\label{eq:test3}
|
||||
f(x) = 3
|
||||
\end{equation}
|
||||
|
||||
\begin{equation}
|
||||
\label{eq:test4}
|
||||
f(x) = 4
|
||||
\end{equation}
|
||||
|
||||
\begin{equation}
|
||||
\label{eq:test5}
|
||||
f(x) = 5
|
||||
\end{equation}
|
||||
|
||||
\begin{equation}
|
||||
\label{eq:test6}
|
||||
f(x) = 6
|
||||
\end{equation}
|
||||
|
||||
\begin{equation}
|
||||
\label{eq:test7}
|
||||
f(x) = 7
|
||||
\end{equation}
|
||||
|
||||
\begin{equation}
|
||||
\label{eq:test8}
|
||||
f(x) = 8
|
||||
\end{equation}
|
||||
|
||||
\begin{equation}
|
||||
\label{eq:test9}
|
||||
f(x) = 9
|
||||
\end{equation}
|
||||
|
||||
\begin{equation}
|
||||
\label{eq:test10}
|
||||
f(x) = 10
|
||||
\end{equation}
|
||||
|
||||
\end{document}
|
||||
|
Loading…
x
Reference in New Issue
Block a user