Fix KTextEditor bugs that are currently partially worked around in KDevelop code
The fixes are detailed in two commit messages - f47916f4 (first 3), 16932f0c (last 2) and discussed in related merge requests.
-
Set m_reloading
tofalse
in the single logical place - just before returning fromDocumentPrivate::documentReload()
. -
ReadOnlyPart::closeUrl()
does not callsetUrl()
when invoked byopenUrl()
, because them_closeUrlFromOpenUrl
flag suppresses it. A similar flag should be introduced inKTextEditor::DocumentPrivate
to prevent the problematic and pointless URL change to empty and back to the original value. Them_reloading
check inDocumentPrivate::slotUrlChanged()
would become redundant and could be removed then. -
Instead of unconditionally calling closeUrl()
and only then informing KDevelop about it,onModOnHdClose()
should emit a signal similar toReadWritePart::sigQueryClose()
before callingcloseUrl()
. KDevelop could then abort closing inonModOnHdClose()
and invokeIDocument::close()
instead. -
Fixing this bug properly requires adding two new signals to KTextEditor::Document
-aboutToReinitializeMarks()
andreinitializedMarks()
. Both overloads ofDocumentPrivate::setText()
should emit the first signal before storing document marks in a local variable, and the second signal - after restoring them. -
This can be fixed in KTextEditor by reordering the clearMarks()
andaboutToInvalidateMovingInterfaceContent()
calls inDocumentPrivate::clear()
.