320 QsciScintilla.SCI_WORDLEFT: self.__QScintillaWordLeft, |
320 QsciScintilla.SCI_WORDLEFT: self.__QScintillaWordLeft, |
321 QsciScintilla.SCI_WORDRIGHT: self.__QScintillaWordRight, |
321 QsciScintilla.SCI_WORDRIGHT: self.__QScintillaWordRight, |
322 QsciScintilla.SCI_VCHOME: self.__QScintillaVCHome, |
322 QsciScintilla.SCI_VCHOME: self.__QScintillaVCHome, |
323 QsciScintilla.SCI_LINEEND: self.__QScintillaLineEnd, |
323 QsciScintilla.SCI_LINEEND: self.__QScintillaLineEnd, |
324 |
324 |
|
325 QsciScintilla.SCI_LINEUP: self.__QScintillaCursorCommand, |
|
326 QsciScintilla.SCI_LINEDOWN: self.__QScintillaCursorCommand, |
|
327 QsciScintilla.SCI_LINESCROLLUP: self.__QScintillaCursorCommand, |
|
328 QsciScintilla.SCI_LINESCROLLDOWN: self.__QScintillaCursorCommand, |
|
329 |
325 QsciScintilla.SCI_PAGEUP: self.__QScintillaAutoCompletionCommand, |
330 QsciScintilla.SCI_PAGEUP: self.__QScintillaAutoCompletionCommand, |
326 QsciScintilla.SCI_PAGEDOWN: self.__QScintillaAutoCompletionCommand, |
331 QsciScintilla.SCI_PAGEDOWN: self.__QScintillaAutoCompletionCommand, |
327 QsciScintilla.SCI_CANCEL: self.__QScintillaAutoCompletionCommand, |
|
328 |
332 |
329 QsciScintilla.SCI_CHARLEFTEXTEND: self.__QScintillaCharLeftExtend, |
333 QsciScintilla.SCI_CHARLEFTEXTEND: self.__QScintillaCharLeftExtend, |
330 QsciScintilla.SCI_CHARRIGHTEXTEND: self.extendSelectionRight, |
334 QsciScintilla.SCI_CHARRIGHTEXTEND: self.extendSelectionRight, |
331 QsciScintilla.SCI_WORDLEFTEXTEND: self.__QScintillaWordLeftExtend, |
335 QsciScintilla.SCI_WORDLEFTEXTEND: self.__QScintillaWordLeftExtend, |
332 QsciScintilla.SCI_WORDRIGHTEXTEND: self.extendSelectionWordRight, |
336 QsciScintilla.SCI_WORDRIGHTEXTEND: self.extendSelectionWordRight, |
333 QsciScintilla.SCI_VCHOMEEXTEND: self.__QScintillaVCHomeExtend, |
337 QsciScintilla.SCI_VCHOMEEXTEND: self.__QScintillaVCHomeExtend, |
334 QsciScintilla.SCI_LINEENDEXTEND: self.extendSelectionToEOL, |
338 QsciScintilla.SCI_LINEENDEXTEND: self.extendSelectionToEOL, |
335 |
339 |
336 QsciScintilla.SCI_CANCEL: self.__QScintillaCancel, |
340 QsciScintilla.SCI_CANCEL: self.__QScintillaCancel, |
337 } |
341 } |
338 self.__setupCursorKeys() |
342 |
|
343 self.__historyNavigateByCursor = \ |
|
344 Preferences.getShell("HistoryNavigateByCursor") |
339 |
345 |
340 self.grabGesture(Qt.PinchGesture) |
346 self.grabGesture(Qt.PinchGesture) |
341 |
|
342 def __setupCursorKeys(self): |
|
343 """ |
|
344 Private method to setup the cursor up and down mode. |
|
345 """ |
|
346 if Preferences.getShell("HistoryNavigateByCursor"): |
|
347 self.supportedEditorCommands.update({ |
|
348 QsciScintilla.SCI_LINEUP: self.__QScintillaHistoryUp, |
|
349 QsciScintilla.SCI_LINEDOWN: self.__QScintillaHistoryDown, |
|
350 QsciScintilla.SCI_LINESCROLLUP: self.__QScintillaLineUp, |
|
351 QsciScintilla.SCI_LINESCROLLDOWN: self.__QScintillaLineDown, |
|
352 }) |
|
353 else: |
|
354 self.supportedEditorCommands.update({ |
|
355 QsciScintilla.SCI_LINEUP: self.__QScintillaLineUp, |
|
356 QsciScintilla.SCI_LINEDOWN: self.__QScintillaLineDown, |
|
357 QsciScintilla.SCI_LINESCROLLUP: self.__QScintillaHistoryUp, |
|
358 QsciScintilla.SCI_LINESCROLLDOWN: self.__QScintillaHistoryDown, |
|
359 }) |
|
360 |
347 |
361 def __showLanguageMenu(self): |
348 def __showLanguageMenu(self): |
362 """ |
349 """ |
363 Private slot to prepare the language submenu. |
350 Private slot to prepare the language submenu. |
364 """ |
351 """ |
1467 if self.isListActive(): |
1454 if self.isListActive(): |
1468 self.SendScintilla(cmd) |
1455 self.SendScintilla(cmd) |
1469 elif self.__isCursorOnLastLine(): |
1456 elif self.__isCursorOnLastLine(): |
1470 self.moveCursorToEOL() |
1457 self.moveCursorToEOL() |
1471 |
1458 |
|
1459 def __QScintillaCursorCommand(self, cmd): |
|
1460 """ |
|
1461 Private method to handle the cursor commands. |
|
1462 |
|
1463 @param cmd QScintilla command |
|
1464 """ |
|
1465 if self.isListActive() or self.isCallTipActive(): |
|
1466 if cmd in (QsciScintilla.SCI_LINEUP, QsciScintilla.SCI_LINEDOWN): |
|
1467 self.SendScintilla(cmd) |
|
1468 else: |
|
1469 if self.__historyNavigateByCursor: |
|
1470 if cmd == QsciScintilla.SCI_LINEUP: |
|
1471 self.__QScintillaHistoryUp(cmd) |
|
1472 elif cmd == QsciScintilla.SCI_LINEDOWN: |
|
1473 self.__QScintillaHistoryDown(cmd) |
|
1474 elif cmd == QsciScintilla.SCI_LINESCROLLUP: |
|
1475 self.__QScintillaLineUp(cmd) |
|
1476 elif cmd == QsciScintilla.SCI_LINESCROLLDOWN: |
|
1477 self.__QScintillaLineDown(cmd) |
|
1478 else: |
|
1479 if cmd == QsciScintilla.SCI_LINEUP: |
|
1480 self.__QScintillaLineUp(cmd) |
|
1481 elif cmd == QsciScintilla.SCI_LINEDOWN: |
|
1482 self.__QScintillaLineDown(cmd) |
|
1483 elif cmd == QsciScintilla.SCI_LINESCROLLUP: |
|
1484 self.__QScintillaHistoryUp(cmd) |
|
1485 elif cmd == QsciScintilla.SCI_LINESCROLLDOWN: |
|
1486 self.__QScintillaHistoryDown(cmd) |
|
1487 |
1472 def __QScintillaLineUp(self, cmd): |
1488 def __QScintillaLineUp(self, cmd): |
1473 """ |
1489 """ |
1474 Private method to handle the cursor up command. |
1490 Private method to handle the cursor up command. |
1475 |
1491 |
1476 @param cmd QScintilla command |
1492 @param cmd QScintilla command |
1570 |
1586 |
1571 def __QScintillaCancel(self): |
1587 def __QScintillaCancel(self): |
1572 """ |
1588 """ |
1573 Private method to handle the ESC command. |
1589 Private method to handle the ESC command. |
1574 """ |
1590 """ |
1575 if self.incrementalSearchActive: |
1591 if self.isListActive() or self.isCallTipActive(): |
1576 self.__resetIncrementalHistorySearch() |
1592 self.SendScintilla(QsciScintilla.SCI_CANCEL) |
1577 self.__insertHistory("") |
1593 else: |
|
1594 if self.incrementalSearchActive: |
|
1595 self.__resetIncrementalHistorySearch() |
|
1596 self.__insertHistory("") |
1578 |
1597 |
1579 def __QScintillaCharLeftExtend(self): |
1598 def __QScintillaCharLeftExtend(self): |
1580 """ |
1599 """ |
1581 Private method to handle the Extend Selection Left command. |
1600 Private method to handle the Extend Selection Left command. |
1582 """ |
1601 """ |
1867 self.__historyStyle = Preferences.getShell("HistoryStyle") |
1886 self.__historyStyle = Preferences.getShell("HistoryStyle") |
1868 self.__historyWrap = Preferences.getShell("HistoryWrap") |
1887 self.__historyWrap = Preferences.getShell("HistoryWrap") |
1869 self.__setHistoryIndex() |
1888 self.__setHistoryIndex() |
1870 if not self.__windowed: |
1889 if not self.__windowed: |
1871 self.hmenu.menuAction().setEnabled(self.isHistoryEnabled()) |
1890 self.hmenu.menuAction().setEnabled(self.isHistoryEnabled()) |
1872 self.__setupCursorKeys() |
1891 self.__historyNavigateByCursor = \ |
|
1892 Preferences.getShell("HistoryNavigateByCursor") |
1873 self.historyStyleChanged.emit(self.__historyStyle) |
1893 self.historyStyleChanged.emit(self.__historyStyle) |
1874 |
1894 |
1875 # do stdout /stderr stuff |
1895 # do stdout /stderr stuff |
1876 showStdOutErr = Preferences.getShell("ShowStdOutErr") |
1896 showStdOutErr = Preferences.getShell("ShowStdOutErr") |
1877 if self.__showStdOutErr != showStdOutErr: |
1897 if self.__showStdOutErr != showStdOutErr: |