Drop the doceditor reloadText function as it resets undo stack
This commit is contained in:
+16
-10
@@ -223,21 +223,12 @@ class GuiDocEditor(QTextEdit):
|
||||
# font changed, otherwise we just clear the editor entirely,
|
||||
# which makes it read only.
|
||||
if self.theHandle is not None:
|
||||
self.reloadText()
|
||||
self.redrawText()
|
||||
else:
|
||||
self.clearEditor()
|
||||
|
||||
return True
|
||||
|
||||
def reloadText(self):
|
||||
"""Reloads the document currently being edited.
|
||||
"""
|
||||
if self.theHandle is not None:
|
||||
tHandle = self.theHandle
|
||||
self.clearEditor()
|
||||
self.loadText(tHandle, showStatus=False)
|
||||
return
|
||||
|
||||
def loadText(self, tHandle, tLine=None, showStatus=True):
|
||||
"""Load text from a document into the editor. If we have an io
|
||||
error, we must handle this and clear the editor so that we don't
|
||||
@@ -297,6 +288,21 @@ class GuiDocEditor(QTextEdit):
|
||||
|
||||
return True
|
||||
|
||||
def reHighLightText(self, forceBigDoc=False):
|
||||
"""Run the syntax highlighter again.
|
||||
"""
|
||||
if not self.bigDoc or forceBigDoc:
|
||||
qApp.setOverrideCursor(QCursor(Qt.WaitCursor))
|
||||
self.hLight.rehighlight()
|
||||
qApp.restoreOverrideCursor()
|
||||
return
|
||||
|
||||
def redrawText(self):
|
||||
"""Redraw the text by marking the document content as "dirty".
|
||||
"""
|
||||
self.qDocument.markContentsDirty(0, self.qDocument.characterCount())
|
||||
return
|
||||
|
||||
def replaceText(self, theText):
|
||||
"""Replaces the text of the current document with the provided
|
||||
text. This also clears undo history.
|
||||
|
||||
+2
-2
@@ -716,13 +716,13 @@ class GuiMain(QMainWindow):
|
||||
|
||||
tEnd = time()
|
||||
self.statusBar.setStatus("Indexing completed in %.1f ms" % ((tEnd - tStart)*1000.0))
|
||||
self.docEditor.reloadText()
|
||||
|
||||
qApp.restoreOverrideCursor()
|
||||
|
||||
if not beQuiet:
|
||||
self.makeAlert("The project index has been successfully rebuilt.", nwAlert.INFO)
|
||||
|
||||
self.docEditor.reHighLightText()
|
||||
|
||||
return True
|
||||
|
||||
def rebuildOutline(self):
|
||||
|
||||
Reference in New Issue
Block a user