mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
lst: avoid accidental modifications of base content
* do not allow to change base content via diff preview
This commit is contained in:
@@ -61,6 +61,7 @@ abstract class LineStatusTrackerBase<R : Range> {
|
||||
|
||||
vcsDocument = DocumentImpl(this.document.immutableCharSequence)
|
||||
vcsDocument.putUserData(UndoConstants.DONT_RECORD_UNDO, true)
|
||||
vcsDocument.setReadOnly(true)
|
||||
|
||||
documentTracker = DocumentTracker(vcsDocument, this.document)
|
||||
documentTracker.addListener(MyLineTrackerListener())
|
||||
@@ -123,7 +124,14 @@ abstract class LineStatusTrackerBase<R : Range> {
|
||||
@CalledInAwt
|
||||
protected fun updateDocument(side: Side, commandName: String?, task: (Document) -> Unit): Boolean {
|
||||
val doc = side[vcsDocument, document]
|
||||
return DiffUtil.executeWriteCommand(doc, project, commandName, { task(doc) })
|
||||
|
||||
if (side.isLeft) doc.setReadOnly(false)
|
||||
try {
|
||||
return DiffUtil.executeWriteCommand(doc, project, commandName, { task(doc) })
|
||||
}
|
||||
finally {
|
||||
if (side.isLeft) doc.setReadOnly(true)
|
||||
}
|
||||
}
|
||||
|
||||
@CalledInAwt
|
||||
|
||||
Reference in New Issue
Block a user