Skip to content

Commit

Permalink
fix issue with home key
Browse files Browse the repository at this point in the history
  • Loading branch information
slarosa committed Sep 10, 2012
1 parent 303f0a6 commit 02b6873
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions python/console_sci.py
Expand Up @@ -89,8 +89,8 @@ def __init__(self, parent=None):
#self.setTabWidth(4)

self.setAutoCompletionThreshold(1)
self.setAutoCompletionSource(self.AcsAPIs)
self.setAutoCompletionSource(self.AcsAPIs)

# Don't want to see the horizontal scrollbar at all
# Use raw message to Scintilla here (all messages are documented
# here: http://www.scintilla.org/ScintillaDoc.html)
Expand All @@ -111,9 +111,11 @@ def __init__(self, parent=None):
self.SendScintilla(QsciScintilla.SCI_CLEARCMDKEY, ord('Y')+ ctrl)
self.SendScintilla(QsciScintilla.SCI_CLEARCMDKEY, ord('L')+ ctrl+shift)

## New QShortcut = ctrl+space for Autocomplete
self.newShortcut = QShortcut(QKeySequence(Qt.CTRL + Qt.Key_Space), self)
self.newShortcut.activated.connect(self.autoComplete)
## New QShortcut = ctrl+space/ctrl+alt+space for Autocomplete
self.newShortcutCS = QShortcut(QKeySequence(Qt.CTRL + Qt.Key_Space), self)
self.newShortcutCAS = QShortcut(QKeySequence(Qt.CTRL + Qt.ALT + Qt.Key_Space), self)
self.newShortcutCS.activated.connect(self.autoComplete)
self.newShortcutCAS.activated.connect(self.autoComplete)

def autoComplete(self):
self.autoCompleteFromAll()
Expand Down Expand Up @@ -360,6 +362,9 @@ def keyPressEvent(self, e):
elif self.is_cursor_on_last_line():
self.SendScintilla(QsciScintilla.SCI_CLEAR)
e.accept()
elif e.key() == Qt.Key_Home:
self.setCursorPosition(linenr,4)
self.ensureCursorVisible()
elif e.key() == Qt.Key_Down and not self.isListActive():
self.showPrevious()
elif e.key() == Qt.Key_Up and not self.isListActive():
Expand Down

0 comments on commit 02b6873

Please sign in to comment.