|
|
|
@ -476,6 +476,14 @@ class TTkTextEditView(TTkAbstractScrollView): |
|
|
|
if c := self._textDocument.restoreSnapshotNext(): |
|
|
|
if c := self._textDocument.restoreSnapshotNext(): |
|
|
|
self._textCursor.restore(c) |
|
|
|
self._textCursor.restore(c) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@pyTTkSlot(TTkString) |
|
|
|
|
|
|
|
def find(self, exp): |
|
|
|
|
|
|
|
if not (cursor := self._textDocument.find(exp)): |
|
|
|
|
|
|
|
return False |
|
|
|
|
|
|
|
self._textCursor = cursor |
|
|
|
|
|
|
|
self._textDocument.cursorPositionChanged.emit(self._textCursor) |
|
|
|
|
|
|
|
return True |
|
|
|
|
|
|
|
|
|
|
|
@pyTTkSlot() |
|
|
|
@pyTTkSlot() |
|
|
|
def clear(self) -> None: |
|
|
|
def clear(self) -> None: |
|
|
|
pass |
|
|
|
pass |
|
|
|
@ -573,6 +581,11 @@ class TTkTextEditView(TTkAbstractScrollView): |
|
|
|
self._scrolToInclude(x,y) |
|
|
|
self._scrolToInclude(x,y) |
|
|
|
return x, y |
|
|
|
return x, y |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@pyTTkSlot() |
|
|
|
|
|
|
|
def ensureCursorVisible(self): |
|
|
|
|
|
|
|
cp = self._textCursor.position() |
|
|
|
|
|
|
|
self._scrolToInclude(cp.pos,cp.line) |
|
|
|
|
|
|
|
|
|
|
|
def _scrolToInclude(self, x, y) -> None: |
|
|
|
def _scrolToInclude(self, x, y) -> None: |
|
|
|
# Scroll the area (if required) to include the position x,y |
|
|
|
# Scroll the area (if required) to include the position x,y |
|
|
|
_,_,w,h = self.geometry() |
|
|
|
_,_,w,h = self.geometry() |
|
|
|
@ -846,6 +859,7 @@ class TTkTextEdit(TTkAbstractScrollArea): |
|
|
|
'extraSelections', 'setExtraSelections', |
|
|
|
'extraSelections', 'setExtraSelections', |
|
|
|
'cut', 'copy', 'paste', |
|
|
|
'cut', 'copy', 'paste', |
|
|
|
'undo', 'redo', 'isUndoAvailable', 'isRedoAvailable', |
|
|
|
'undo', 'redo', 'isUndoAvailable', 'isRedoAvailable', |
|
|
|
|
|
|
|
'find', 'ensureCursorVisible', |
|
|
|
# Export Methods, |
|
|
|
# Export Methods, |
|
|
|
'toAnsi', 'toRawText', 'toPlainText', # 'toHtml', 'toMarkdown', |
|
|
|
'toAnsi', 'toRawText', 'toPlainText', # 'toHtml', 'toMarkdown', |
|
|
|
]) |
|
|
|
]) |
|
|
|
|