From 91b433277489f94ac79ad141d43bb0f9434c9f00 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Fri, 26 Jun 2015 17:07:23 +0200 Subject: [PATCH] Fix ValueError with cmdline call signatures MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Commit 8016665 escaped the newlines in `text`, which requires to use the escaped version with `text.index` and `len`, too. This fixes the following error: Traceback (most recent call last): File "…/jedi/jedi_vim.py", line 110, in wrapper return func(*args, **kwargs) File "…/jedi/jedi_vim.py", line 414, in cmdline_call_signatures left = text.index(params[index]) ValueError: substring not found --- jedi_vim.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/jedi_vim.py b/jedi_vim.py index 266ee35..65b8189 100644 --- a/jedi_vim.py +++ b/jedi_vim.py @@ -411,8 +411,9 @@ def cmdline_call_signatures(signatures): try: index = [s.index for s in signatures if isinstance(s.index, int)][0] - left = text.index(params[index]) - right = left + len(params[index]) + escaped_param = params[index].replace(r'\n', r'\\n') + left = text.index(escaped_param) + right = left + len(escaped_param) vim_command(' echon "%s" | ' 'echohl Function | echon "%s" | ' 'echohl None | echon "(" | '