Skip to content

Commit

Permalink
another fix to mouse event:
Browse files Browse the repository at this point in the history
- prevents paste text if cursor is not in edition zone
  • Loading branch information
slarosa committed Oct 6, 2012
1 parent 50c28a9 commit ea7f34a
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions python/console_sci.py
Expand Up @@ -437,13 +437,18 @@ def mousePressEvent(self, e):
Re-implemented to handle the mouse press event.
e: the mouse press event (QMouseEvent)
"""
if e.button() == Qt.MidButton:
stringSel = unicode(QApplication.clipboard().text(QClipboard.Selection))
self.insertFromDropPaste(stringSel)
self.setFocus()
e.accept()
linenr, index = self.getCurLine()
## Prevents paste text if cursor is not in edition zone
if not self.is_cursor_on_last_line() or index < 4:
self.move_cursor_to_end()
else:
QsciScintilla.mousePressEvent(self, e)
if e.button() == Qt.MidButton:
stringSel = unicode(QApplication.clipboard().text(QClipboard.Selection))
self.insertFromDropPaste(stringSel)
self.setFocus()
e.accept()
else:
QsciScintilla.mousePressEvent(self, e)

def paste(self):
"""Reimplement QScintilla method"""
Expand Down

0 comments on commit ea7f34a

Please sign in to comment.