@@ -326,7 +326,6 @@ def showPrevious(self):
326
326
self .move_cursor_to_end ()
327
327
#self.SendScintilla(QsciScintilla.SCI_DELETEBACK)
328
328
329
-
330
329
def showNext (self ):
331
330
if self .historyIndex > 0 and not self .history .isEmpty ():
332
331
line , pos = self .getCurLine ()
@@ -367,7 +366,6 @@ def keyPressEvent(self, e):
367
366
QsciScintilla .keyPressEvent (self , e )
368
367
elif e .key () == Qt .Key_Delete :
369
368
if self .hasSelectedText ():
370
- self .check_selection ()
371
369
self .removeSelectedText ()
372
370
elif self .is_cursor_on_last_line ():
373
371
self .SendScintilla (QsciScintilla .SCI_CLEAR )
@@ -418,28 +416,29 @@ def keyPressEvent(self, e):
418
416
def paste (self ):
419
417
"""Reimplement QScintilla method"""
420
418
stringPaste = unicode (QApplication .clipboard ().text ())
419
+ if self .hasSelectedText ():
420
+ self .removeSelectedText ()
421
421
self .insertFromDropPaste (stringPaste )
422
422
423
423
## Drag and drop
424
- def dragEnterEvent (self , e ):
425
- 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 )
426
429
e .accept ()
427
430
else :
428
- e . ignore ()
431
+ QsciScintillaCompat . dropEvent ( self , e )
429
432
430
- def dropEvent (self , e ):
431
- stringDrag = e .mimeData ().text ()
432
- self .insertFromDropPaste (stringDrag )
433
-
434
433
def insertFromDropPaste (self , textDP ):
435
434
pasteList = QStringList ()
436
435
pasteList = textDP .split ("\n " )
437
436
for line in pasteList [:- 1 ]:
438
- self .append (line )
437
+ self .insert (line )
439
438
self .move_cursor_to_end ()
440
439
#self.SendScintilla(QsciScintilla.SCI_DELETEBACK)
441
440
self .runCommand (unicode (self .currentCommand ()))
442
- self .append (unicode (pasteList [- 1 ]))
441
+ self .insert (unicode (pasteList [- 1 ]))
443
442
self .move_cursor_to_end ()
444
443
445
444
def getTextFromEditor (self ):
0 commit comments