mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Improve undo if patch engine is enabled
Reset undo history when we are rebasing patch engine requests Synchronize commands from backend and frontend GitOrigin-RevId: 67b7fda4e07a9db1b8f2dea013a78533d7276ef4
This commit is contained in:
committed by
intellij-monorepo-bot
parent
717674d6da
commit
ee39112b21
@@ -13004,6 +13004,7 @@ f:com.intellij.openapi.editor.actions.DuplicateLinesAction
|
||||
- <init>():V
|
||||
f:com.intellij.openapi.editor.actions.EditorActionUtil
|
||||
- sf:DELETE_COMMAND_GROUP:java.lang.Object
|
||||
- sf:EDIT_COMMAND_GROUP:java.lang.Object
|
||||
- s:findFirstNonSpaceColumnOnTheLine(com.intellij.openapi.editor.Editor,I):I
|
||||
- s:findFirstNonSpaceOffsetInRange(java.lang.CharSequence,I,I):I
|
||||
- s:findFirstNonSpaceOffsetOnTheLine(com.intellij.openapi.editor.Document,I):I
|
||||
|
||||
@@ -466,7 +466,7 @@ public final class UndoManagerImpl extends UndoManager {
|
||||
|
||||
@Nullable
|
||||
@ApiStatus.Internal
|
||||
public ResetUndoHistoryToken createResetUndoHistoryToken(FileEditor editor) {
|
||||
public ResetUndoHistoryToken createResetUndoHistoryToken(@NotNull FileEditor editor) {
|
||||
Collection<DocumentReference> references = getDocumentReferences(editor);
|
||||
if (references.size() != 1)
|
||||
return null;
|
||||
@@ -519,9 +519,11 @@ public final class UndoManagerImpl extends UndoManager {
|
||||
return;
|
||||
}
|
||||
state.myCurrentOperationState = isUndo ? OperationState.UNDO : OperationState.REDO;
|
||||
Disposable disposable = Disposer.newDisposable();
|
||||
try {
|
||||
final RuntimeException[] exception = new RuntimeException[1];
|
||||
Runnable executeUndoOrRedoAction = () -> {
|
||||
ApplicationManager.getApplication().getMessageBus().syncPublisher(UndoRedoListener.Companion.getTOPIC()).undoRedoStarted(myProject, this, editor, isUndo, disposable);
|
||||
try {
|
||||
CopyPasteManager.getInstance().stopKillRings();
|
||||
state.myMerger.undoOrRedo(editor, isUndo);
|
||||
@@ -536,6 +538,7 @@ public final class UndoManagerImpl extends UndoManager {
|
||||
if (exception[0] != null) throw exception[0];
|
||||
}
|
||||
finally {
|
||||
Disposer.dispose(disposable);
|
||||
state.myCurrentOperationState = OperationState.NONE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.openapi.command.impl
|
||||
|
||||
import com.intellij.openapi.Disposable
|
||||
import com.intellij.openapi.command.undo.UndoManager
|
||||
import com.intellij.openapi.fileEditor.FileEditor
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.util.messages.Topic
|
||||
import org.jetbrains.annotations.ApiStatus.Experimental
|
||||
import org.jetbrains.annotations.ApiStatus.Internal
|
||||
|
||||
@Internal
|
||||
@Experimental
|
||||
interface UndoRedoListener {
|
||||
companion object {
|
||||
val TOPIC: Topic<UndoRedoListener> = Topic(UndoRedoListener::class.java, Topic.BroadcastDirection.NONE)
|
||||
}
|
||||
|
||||
fun undoRedoStarted(project: Project?, undoManager: UndoManager, editor: FileEditor?, isUndo: Boolean, disposable: Disposable)
|
||||
}
|
||||
+1
-1
@@ -25,7 +25,7 @@ import java.awt.*;
|
||||
import static java.lang.Character.*;
|
||||
|
||||
public final class EditorActionUtil {
|
||||
static final Object EDIT_COMMAND_GROUP = Key.create("EditGroup");
|
||||
public static final Object EDIT_COMMAND_GROUP = Key.create("EditGroup");
|
||||
public static final Object DELETE_COMMAND_GROUP = Key.create("DeleteGroup");
|
||||
|
||||
private EditorActionUtil() {
|
||||
|
||||
Reference in New Issue
Block a user