Fri, 22 Dec 2017 19:52:58 +0100
Fixed an issue related to cursor key navigation within completion lists caused by the new history navigation style.
--- a/Documentation/Help/source.qhp Fri Dec 22 18:26:42 2017 +0100 +++ b/Documentation/Help/source.qhp Fri Dec 22 19:52:58 2017 +0100 @@ -14003,6 +14003,7 @@ <keyword name="Shell.__QScintillaCharLeftExtend" id="Shell.__QScintillaCharLeftExtend" ref="eric6.QScintilla.Shell.html#Shell.__QScintillaCharLeftExtend" /> <keyword name="Shell.__QScintillaCharRight" id="Shell.__QScintillaCharRight" ref="eric6.QScintilla.Shell.html#Shell.__QScintillaCharRight" /> <keyword name="Shell.__QScintillaCommand" id="Shell.__QScintillaCommand" ref="eric6.QScintilla.Shell.html#Shell.__QScintillaCommand" /> + <keyword name="Shell.__QScintillaCursorCommand" id="Shell.__QScintillaCursorCommand" ref="eric6.QScintilla.Shell.html#Shell.__QScintillaCursorCommand" /> <keyword name="Shell.__QScintillaDelete" id="Shell.__QScintillaDelete" ref="eric6.QScintilla.Shell.html#Shell.__QScintillaDelete" /> <keyword name="Shell.__QScintillaDeleteBack" id="Shell.__QScintillaDeleteBack" ref="eric6.QScintilla.Shell.html#Shell.__QScintillaDeleteBack" /> <keyword name="Shell.__QScintillaDeleteLineLeft" id="Shell.__QScintillaDeleteLineLeft" ref="eric6.QScintilla.Shell.html#Shell.__QScintillaDeleteLineLeft" /> @@ -14062,7 +14063,6 @@ <keyword name="Shell.__setMargin0" id="Shell.__setMargin0" ref="eric6.QScintilla.Shell.html#Shell.__setMargin0" /> <keyword name="Shell.__setMonospaced" id="Shell.__setMonospaced" ref="eric6.QScintilla.Shell.html#Shell.__setMonospaced" /> <keyword name="Shell.__setTextDisplay" id="Shell.__setTextDisplay" ref="eric6.QScintilla.Shell.html#Shell.__setTextDisplay" /> - <keyword name="Shell.__setupCursorKeys" id="Shell.__setupCursorKeys" ref="eric6.QScintilla.Shell.html#Shell.__setupCursorKeys" /> <keyword name="Shell.__showCompletions" id="Shell.__showCompletions" ref="eric6.QScintilla.Shell.html#Shell.__showCompletions" /> <keyword name="Shell.__showLanguageMenu" id="Shell.__showLanguageMenu" ref="eric6.QScintilla.Shell.html#Shell.__showLanguageMenu" /> <keyword name="Shell.__startDebugClient" id="Shell.__startDebugClient" ref="eric6.QScintilla.Shell.html#Shell.__startDebugClient" />
--- a/Documentation/Source/eric6.QScintilla.Shell.html Fri Dec 22 18:26:42 2017 +0100 +++ b/Documentation/Source/eric6.QScintilla.Shell.html Fri Dec 22 19:52:58 2017 +0100 @@ -98,6 +98,9 @@ <td><a href="#Shell.__QScintillaCommand">__QScintillaCommand</a></td> <td>Private method to send the command to QScintilla.</td> </tr><tr> +<td><a href="#Shell.__QScintillaCursorCommand">__QScintillaCursorCommand</a></td> +<td>Private method to handle the cursor commands.</td> +</tr><tr> <td><a href="#Shell.__QScintillaDelete">__QScintillaDelete</a></td> <td>Private method to handle the delete command.</td> </tr><tr> @@ -275,9 +278,6 @@ <td><a href="#Shell.__setTextDisplay">__setTextDisplay</a></td> <td>Private method to configure the text display.</td> </tr><tr> -<td><a href="#Shell.__setupCursorKeys">__setupCursorKeys</a></td> -<td>Private method to setup the cursor up and down mode.</td> -</tr><tr> <td><a href="#Shell.__showCompletions">__showCompletions</a></td> <td>Private method to display the possible completions.</td> </tr><tr> @@ -475,6 +475,16 @@ <dd> QScintilla command </dd> +</dl><a NAME="Shell.__QScintillaCursorCommand" ID="Shell.__QScintillaCursorCommand"></a> +<h4>Shell.__QScintillaCursorCommand</h4> +<b>__QScintillaCursorCommand</b>(<i>cmd</i>) +<p> + Private method to handle the cursor commands. +</p><dl> +<dt><i>cmd</i></dt> +<dd> +QScintilla command +</dd> </dl><a NAME="Shell.__QScintillaDelete" ID="Shell.__QScintillaDelete"></a> <h4>Shell.__QScintillaDelete</h4> <b>__QScintillaDelete</b>(<i></i>) @@ -1033,11 +1043,6 @@ <b>__setTextDisplay</b>(<i></i>) <p> Private method to configure the text display. -</p><a NAME="Shell.__setupCursorKeys" ID="Shell.__setupCursorKeys"></a> -<h4>Shell.__setupCursorKeys</h4> -<b>__setupCursorKeys</b>(<i></i>) -<p> - Private method to setup the cursor up and down mode. </p><a NAME="Shell.__showCompletions" ID="Shell.__showCompletions"></a> <h4>Shell.__showCompletions</h4> <b>__showCompletions</b>(<i>completions, text</i>)
--- a/QScintilla/Shell.py Fri Dec 22 18:26:42 2017 +0100 +++ b/QScintilla/Shell.py Fri Dec 22 19:52:58 2017 +0100 @@ -322,9 +322,13 @@ QsciScintilla.SCI_VCHOME: self.__QScintillaVCHome, QsciScintilla.SCI_LINEEND: self.__QScintillaLineEnd, + QsciScintilla.SCI_LINEUP: self.__QScintillaCursorCommand, + QsciScintilla.SCI_LINEDOWN: self.__QScintillaCursorCommand, + QsciScintilla.SCI_LINESCROLLUP: self.__QScintillaCursorCommand, + QsciScintilla.SCI_LINESCROLLDOWN: self.__QScintillaCursorCommand, + QsciScintilla.SCI_PAGEUP: self.__QScintillaAutoCompletionCommand, QsciScintilla.SCI_PAGEDOWN: self.__QScintillaAutoCompletionCommand, - QsciScintilla.SCI_CANCEL: self.__QScintillaAutoCompletionCommand, QsciScintilla.SCI_CHARLEFTEXTEND: self.__QScintillaCharLeftExtend, QsciScintilla.SCI_CHARRIGHTEXTEND: self.extendSelectionRight, @@ -335,29 +339,12 @@ QsciScintilla.SCI_CANCEL: self.__QScintillaCancel, } - self.__setupCursorKeys() + + self.__historyNavigateByCursor = \ + Preferences.getShell("HistoryNavigateByCursor") self.grabGesture(Qt.PinchGesture) - def __setupCursorKeys(self): - """ - Private method to setup the cursor up and down mode. - """ - if Preferences.getShell("HistoryNavigateByCursor"): - self.supportedEditorCommands.update({ - QsciScintilla.SCI_LINEUP: self.__QScintillaHistoryUp, - QsciScintilla.SCI_LINEDOWN: self.__QScintillaHistoryDown, - QsciScintilla.SCI_LINESCROLLUP: self.__QScintillaLineUp, - QsciScintilla.SCI_LINESCROLLDOWN: self.__QScintillaLineDown, - }) - else: - self.supportedEditorCommands.update({ - QsciScintilla.SCI_LINEUP: self.__QScintillaLineUp, - QsciScintilla.SCI_LINEDOWN: self.__QScintillaLineDown, - QsciScintilla.SCI_LINESCROLLUP: self.__QScintillaHistoryUp, - QsciScintilla.SCI_LINESCROLLDOWN: self.__QScintillaHistoryDown, - }) - def __showLanguageMenu(self): """ Private slot to prepare the language submenu. @@ -1469,6 +1456,35 @@ elif self.__isCursorOnLastLine(): self.moveCursorToEOL() + def __QScintillaCursorCommand(self, cmd): + """ + Private method to handle the cursor commands. + + @param cmd QScintilla command + """ + if self.isListActive() or self.isCallTipActive(): + if cmd in (QsciScintilla.SCI_LINEUP, QsciScintilla.SCI_LINEDOWN): + self.SendScintilla(cmd) + else: + if self.__historyNavigateByCursor: + if cmd == QsciScintilla.SCI_LINEUP: + self.__QScintillaHistoryUp(cmd) + elif cmd == QsciScintilla.SCI_LINEDOWN: + self.__QScintillaHistoryDown(cmd) + elif cmd == QsciScintilla.SCI_LINESCROLLUP: + self.__QScintillaLineUp(cmd) + elif cmd == QsciScintilla.SCI_LINESCROLLDOWN: + self.__QScintillaLineDown(cmd) + else: + if cmd == QsciScintilla.SCI_LINEUP: + self.__QScintillaLineUp(cmd) + elif cmd == QsciScintilla.SCI_LINEDOWN: + self.__QScintillaLineDown(cmd) + elif cmd == QsciScintilla.SCI_LINESCROLLUP: + self.__QScintillaHistoryUp(cmd) + elif cmd == QsciScintilla.SCI_LINESCROLLDOWN: + self.__QScintillaHistoryDown(cmd) + def __QScintillaLineUp(self, cmd): """ Private method to handle the cursor up command. @@ -1572,9 +1588,12 @@ """ Private method to handle the ESC command. """ - if self.incrementalSearchActive: - self.__resetIncrementalHistorySearch() - self.__insertHistory("") + if self.isListActive() or self.isCallTipActive(): + self.SendScintilla(QsciScintilla.SCI_CANCEL) + else: + if self.incrementalSearchActive: + self.__resetIncrementalHistorySearch() + self.__insertHistory("") def __QScintillaCharLeftExtend(self): """ @@ -1869,7 +1888,8 @@ self.__setHistoryIndex() if not self.__windowed: self.hmenu.menuAction().setEnabled(self.isHistoryEnabled()) - self.__setupCursorKeys() + self.__historyNavigateByCursor = \ + Preferences.getShell("HistoryNavigateByCursor") self.historyStyleChanged.emit(self.__historyStyle) # do stdout /stderr stuff