@@ -124,6 +124,8 @@ def clearConsole(self):
124
124
self .setFocus ()
125
125
126
126
def commandConsole (self , command ):
127
+ if not self .is_cursor_on_last_line ():
128
+ self .move_cursor_to_end ()
127
129
line , pos = self .getCurLine ()
128
130
selCmd = self .text (line ).length ()
129
131
self .setSelection (line , 4 , line , selCmd )
@@ -324,7 +326,6 @@ def showPrevious(self):
324
326
self .move_cursor_to_end ()
325
327
#self.SendScintilla(QsciScintilla.SCI_DELETEBACK)
326
328
327
-
328
329
def showNext (self ):
329
330
if self .historyIndex > 0 and not self .history .isEmpty ():
330
331
line , pos = self .getCurLine ()
@@ -365,7 +366,6 @@ def keyPressEvent(self, e):
365
366
QsciScintilla .keyPressEvent (self , e )
366
367
elif e .key () == Qt .Key_Delete :
367
368
if self .hasSelectedText ():
368
- self .check_selection ()
369
369
self .removeSelectedText ()
370
370
elif self .is_cursor_on_last_line ():
371
371
self .SendScintilla (QsciScintilla .SCI_CLEAR )
@@ -405,13 +405,6 @@ def keyPressEvent(self, e):
405
405
self .SendScintilla (QsciScintilla .SCI_WORDRIGHT )
406
406
else :
407
407
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 ()
415
408
## TODO: press event for auto-completion file directory
416
409
#elif e.key() == Qt.Key_Tab:
417
410
#self.show_file_completion()
@@ -423,28 +416,29 @@ def keyPressEvent(self, e):
423
416
def paste (self ):
424
417
"""Reimplement QScintilla method"""
425
418
stringPaste = unicode (QApplication .clipboard ().text ())
419
+ if self .hasSelectedText ():
420
+ self .removeSelectedText ()
426
421
self .insertFromDropPaste (stringPaste )
427
422
428
423
## 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 )
431
429
e .accept ()
432
430
else :
433
- e . ignore ()
431
+ QsciScintillaCompat . dropEvent ( self , e )
434
432
435
- def dropEvent (self , e ):
436
- stringDrag = e .mimeData ().text ()
437
- self .insertFromDropPaste (stringDrag )
438
-
439
433
def insertFromDropPaste (self , textDP ):
440
434
pasteList = QStringList ()
441
435
pasteList = textDP .split ("\n " )
442
436
for line in pasteList [:- 1 ]:
443
- self .append (line )
437
+ self .insert (line )
444
438
self .move_cursor_to_end ()
445
439
#self.SendScintilla(QsciScintilla.SCI_DELETEBACK)
446
440
self .runCommand (unicode (self .currentCommand ()))
447
- self .append (unicode (pasteList [- 1 ]))
441
+ self .insert (unicode (pasteList [- 1 ]))
448
442
self .move_cursor_to_end ()
449
443
450
444
def getTextFromEditor (self ):
0 commit comments