Skip to content

Commit

Permalink
Merge fbb9bcd into 4842ace
Browse files Browse the repository at this point in the history
  • Loading branch information
impact27 committed Aug 28, 2019
2 parents 4842ace + fbb9bcd commit caaab48
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
13 changes: 6 additions & 7 deletions qtconsole/frontend_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,8 @@ def _lexer_default(self):
exit_requested = QtCore.Signal(object)

_CallTipRequest = namedtuple('_CallTipRequest', ['id', 'pos'])
_CompletionRequest = namedtuple('_CompletionRequest', ['id', 'pos'])
_CompletionRequest = namedtuple('_CompletionRequest',
['id', 'code', 'pos'])
_ExecutionRequest = namedtuple('_ExecutionRequest', ['id', 'kind'])
_local_kernel = False
_highlighter = Instance(FrontendHighlighter, allow_none=True)
Expand Down Expand Up @@ -727,13 +728,11 @@ def _call_tip(self):
def _complete(self):
""" Performs completion at the current cursor location.
"""
code = self.input_buffer
cursor_pos = self._get_input_buffer_cursor_pos()
# Send the completion request to the kernel
msg_id = self.kernel_client.complete(
code=self.input_buffer,
cursor_pos=self._get_input_buffer_cursor_pos(),
)
pos = self._get_cursor().position()
info = self._CompletionRequest(msg_id, pos)
msg_id = self.kernel_client.complete(code=code, cursor_pos=cursor_pos)
info = self._CompletionRequest(msg_id, code, cursor_pos)
self._request_info['complete'] = info

def _process_execute_abort(self, msg):
Expand Down
5 changes: 3 additions & 2 deletions qtconsole/jupyter_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,9 @@ def _handle_complete_reply(self, rep):
self.log.debug("complete: %s", rep.get('content', ''))
cursor = self._get_cursor()
info = self._request_info.get('complete')
if info and info.id == rep['parent_header']['msg_id'] and \
info.pos == cursor.position():
if (info and info.id == rep['parent_header']['msg_id']
and info.pos == self._get_input_buffer_cursor_pos()
and info.code == self.input_buffer):
content = rep['content']
matches = content['matches']
start = content['cursor_start']
Expand Down

0 comments on commit caaab48

Please sign in to comment.