diff --git a/IPython/frontend/qt/console/completion_widget.py b/IPython/frontend/qt/console/completion_widget.py index a11e38c..194b843 100644 --- a/IPython/frontend/qt/console/completion_widget.py +++ b/IPython/frontend/qt/console/completion_widget.py @@ -86,10 +86,11 @@ class CompletionWidget(QtGui.QListWidget): text_edit = self._text_edit point = text_edit.cursorRect(cursor).bottomRight() point = text_edit.mapToGlobal(point) + height = self.sizeHint().height() screen_rect = QtGui.QApplication.desktop().availableGeometry(self) - if screen_rect.size().height() - point.y() - self.height() < 0: + if screen_rect.size().height() - point.y() - height < 0: point = text_edit.mapToGlobal(text_edit.cursorRect().topRight()) - point.setY(point.y() - self.height()) + point.setY(point.y() - height) self.move(point) self._start_position = cursor.position() diff --git a/IPython/frontend/qt/console/console_widget.py b/IPython/frontend/qt/console/console_widget.py index 172b21c..52b5684 100644 --- a/IPython/frontend/qt/console/console_widget.py +++ b/IPython/frontend/qt/console/console_widget.py @@ -1261,6 +1261,7 @@ class ConsoleWidget(LoggingConfigurable, QtGui.QWidget): elif key in (QtCore.Qt.Key_Q, QtCore.Qt.Key_Escape): if self._splitter: self._page_control.hide() + self._control.setFocus() else: self.layout().setCurrentWidget(self._control) return True