Skip to content

Commit bf985a5

Browse files
committed
Merge branch 'master' of https://github.com/qgis/Quantum-GIS
2 parents d80d3cf + 1b95cdc commit bf985a5

File tree

1 file changed

+12
-18
lines changed

1 file changed

+12
-18
lines changed

python/console_sci.py

+12-18
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@ def clearConsole(self):
124124
self.setFocus()
125125

126126
def commandConsole(self, command):
127+
if not self.is_cursor_on_last_line():
128+
self.move_cursor_to_end()
127129
line, pos = self.getCurLine()
128130
selCmd= self.text(line).length()
129131
self.setSelection(line, 4, line, selCmd)
@@ -324,7 +326,6 @@ def showPrevious(self):
324326
self.move_cursor_to_end()
325327
#self.SendScintilla(QsciScintilla.SCI_DELETEBACK)
326328

327-
328329
def showNext(self):
329330
if self.historyIndex > 0 and not self.history.isEmpty():
330331
line, pos = self.getCurLine()
@@ -365,7 +366,6 @@ def keyPressEvent(self, e):
365366
QsciScintilla.keyPressEvent(self, e)
366367
elif e.key() == Qt.Key_Delete:
367368
if self.hasSelectedText():
368-
self.check_selection()
369369
self.removeSelectedText()
370370
elif self.is_cursor_on_last_line():
371371
self.SendScintilla(QsciScintilla.SCI_CLEAR)
@@ -405,13 +405,6 @@ def keyPressEvent(self, e):
405405
self.SendScintilla(QsciScintilla.SCI_WORDRIGHT)
406406
else:
407407
self.SendScintilla(QsciScintilla.SCI_CHARRIGHT)
408-
elif e.key() == Qt.Key_Delete:
409-
if self.hasSelectedText():
410-
self.check_selection()
411-
self.removeSelectedText()
412-
elif self.is_cursor_on_last_line():
413-
self.SendScintilla(QsciScintilla.SCI_CLEAR)
414-
event.accept()
415408
## TODO: press event for auto-completion file directory
416409
#elif e.key() == Qt.Key_Tab:
417410
#self.show_file_completion()
@@ -423,28 +416,29 @@ def keyPressEvent(self, e):
423416
def paste(self):
424417
"""Reimplement QScintilla method"""
425418
stringPaste = unicode(QApplication.clipboard().text())
419+
if self.hasSelectedText():
420+
self.removeSelectedText()
426421
self.insertFromDropPaste(stringPaste)
427422

428423
## Drag and drop
429-
def dragEnterEvent(self, e):
430-
if e.mimeData().hasFormat('text/plain'):
424+
def dropEvent(self, e):
425+
if e.mimeData().hasText():
426+
stringDrag = e.mimeData().text()
427+
self.insertFromDropPaste(stringDrag)
428+
e.setDropAction(Qt.MoveAction)
431429
e.accept()
432430
else:
433-
e.ignore()
431+
QsciScintillaCompat.dropEvent(self, e)
434432

435-
def dropEvent(self, e):
436-
stringDrag = e.mimeData().text()
437-
self.insertFromDropPaste(stringDrag)
438-
439433
def insertFromDropPaste(self, textDP):
440434
pasteList = QStringList()
441435
pasteList = textDP.split("\n")
442436
for line in pasteList[:-1]:
443-
self.append(line)
437+
self.insert(line)
444438
self.move_cursor_to_end()
445439
#self.SendScintilla(QsciScintilla.SCI_DELETEBACK)
446440
self.runCommand(unicode(self.currentCommand()))
447-
self.append(unicode(pasteList[-1]))
441+
self.insert(unicode(pasteList[-1]))
448442
self.move_cursor_to_end()
449443

450444
def getTextFromEditor(self):

0 commit comments

Comments
 (0)