Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 2.0.4, 2.0.5, and 2.1

stable cmdui: make sure newly-opened prompt line is visible (fixes #42)

Because scintilla delays line wrapping, it should re-scroll on painted
notification.

> To scroll to the position correctly, delay the scroll until the wrapping
> has been performed by waiting for an initial SCN_PAINTED notification.

(from http://www.scintilla.org/ScintillaDoc.html#LineWrapping)

Changeset d4fc350ab1d2

Parent eb514f9e9e6e

by Yuya Nishihara

Changes to one file · Browse files at d4fc350ab1d2 Showing diff from parent eb514f9e9e6e Diff from another changeset...

 
403
404
405
 
 
 
 
 
 
 
 
 
 
 
406
407
408
 
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
@@ -403,6 +403,17 @@
  self.setCursorPosition(self.lines() - 1, len(self._prompt))   self.setReadOnly(False)   + # make sure the prompt line is visible. Because QsciScintilla may + # delay line wrapping, setCursorPosition() doesn't always scrolls + # to the correct position. + # http://www.scintilla.org/ScintillaDoc.html#LineWrapping + self.SCN_PAINTED.connect(self._scrollCaretOnPainted) + + @pyqtSlot() + def _scrollCaretOnPainted(self): + self.SCN_PAINTED.disconnect(self._scrollCaretOnPainted) + self.SendScintilla(self.SCI_SCROLLCARET) +   @pyqtSlot()   def closePrompt(self):   """Disable user input"""