mirror of
https://github.com/davidhalter/jedi-vim.git
synced 2025-12-07 11:14:32 +08:00
Use utf8 ellipsis char instead of 3 dots
This commit is contained in:
18
jedi_vim.py
18
jedi_vim.py
@@ -1,3 +1,4 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
"""
|
"""
|
||||||
The Python parts of the Jedi library for VIM. It is mostly about communicating
|
The Python parts of the Jedi library for VIM. It is mostly about communicating
|
||||||
with VIM.
|
with VIM.
|
||||||
@@ -18,7 +19,10 @@ except ImportError:
|
|||||||
|
|
||||||
is_py3 = sys.version_info[0] >= 3
|
is_py3 = sys.version_info[0] >= 3
|
||||||
if is_py3:
|
if is_py3:
|
||||||
|
ELLIPSIS = "…"
|
||||||
unicode = str
|
unicode = str
|
||||||
|
else:
|
||||||
|
ELLIPSIS = u"…"
|
||||||
|
|
||||||
|
|
||||||
class PythonToVimStr(unicode):
|
class PythonToVimStr(unicode):
|
||||||
@@ -434,22 +438,22 @@ def cmdline_call_signatures(signatures):
|
|||||||
return
|
return
|
||||||
elif index is None:
|
elif index is None:
|
||||||
pass
|
pass
|
||||||
elif max_msg_len < len('...'):
|
elif max_msg_len < len(ELLIPSIS):
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
left = escape(', '.join(params[:index]))
|
left = escape(', '.join(params[:index]))
|
||||||
center = escape(params[index])
|
center = escape(params[index])
|
||||||
right = escape(', '.join(params[index + 1:]))
|
right = escape(', '.join(params[index + 1:]))
|
||||||
while too_long():
|
while too_long():
|
||||||
if left and left != '...':
|
if left and left != ELLIPSIS:
|
||||||
left = '...'
|
left = ELLIPSIS
|
||||||
continue
|
continue
|
||||||
if right and right != '...':
|
if right and right != ELLIPSIS:
|
||||||
right = '...'
|
right = ELLIPSIS
|
||||||
continue
|
continue
|
||||||
if (left or right) and center != '...':
|
if (left or right) and center != ELLIPSIS:
|
||||||
left = right = None
|
left = right = None
|
||||||
center = '...'
|
center = ELLIPSIS
|
||||||
continue
|
continue
|
||||||
if too_long():
|
if too_long():
|
||||||
# Should never reach here
|
# Should never reach here
|
||||||
|
|||||||
@@ -68,22 +68,22 @@ describe 'signatures'
|
|||||||
put = 'def '.funcname.'(arg1, arg2, arg3, a, b, c):'
|
put = 'def '.funcname.'(arg1, arg2, arg3, a, b, c):'
|
||||||
put = ' pass'
|
put = ' pass'
|
||||||
execute "normal o".funcname."( "
|
execute "normal o".funcname."( "
|
||||||
Expect Signature() == "\n".funcname."(arg1, ...)"
|
Expect Signature() == "\n".funcname."(arg1, …)"
|
||||||
|
|
||||||
normal sarg1,
|
normal sarg1,
|
||||||
Expect Signature() == "\n".funcname."(..., arg2, ...)"
|
Expect Signature() == "\n".funcname."(…, arg2, …)"
|
||||||
|
|
||||||
normal sarg2, arg3,
|
normal sarg2, arg3,
|
||||||
Expect Signature() == "\n".funcname."(..., a, b, c)"
|
Expect Signature() == "\n".funcname."(…, a, b, c)"
|
||||||
|
|
||||||
normal sa, b,
|
normal sa, b,
|
||||||
Expect Signature() == "\n".funcname."(..., c)"
|
Expect Signature() == "\n".funcname."(…, c)"
|
||||||
|
|
||||||
g/^/d
|
g/^/d
|
||||||
put = 'def '.funcname.'('.repeat('b', 20).', arg2):'
|
put = 'def '.funcname.'('.repeat('b', 20).', arg2):'
|
||||||
put = ' pass'
|
put = ' pass'
|
||||||
execute "normal o".funcname."( "
|
execute "normal o".funcname."( "
|
||||||
Expect Signature() == "\n".funcname."(...)"
|
Expect Signature() == "\n".funcname."(…)"
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'command line no signature'
|
it 'command line no signature'
|
||||||
|
|||||||
Reference in New Issue
Block a user