mirror of
https://github.com/carlrobertoh/ProxyAI.git
synced 2026-05-08 18:31:19 +00:00
fix: replace code selection behaviour (fixes #614)
This commit is contained in:
parent
f60fabcded
commit
2b9eaea9d4
2 changed files with 10 additions and 4 deletions
|
|
@ -30,9 +30,12 @@ public class ReplaceCodeInMainEditorAction extends AnAction {
|
|||
var project = event.getProject();
|
||||
var toolWindowEditor = event.getData(PlatformDataKeys.EDITOR);
|
||||
if (project != null && toolWindowEditor != null) {
|
||||
EditorUtil.replaceEditorSelection(
|
||||
toolWindowEditor,
|
||||
requireNonNull(toolWindowEditor.getSelectionModel().getSelectedText()));
|
||||
var mainEditor = EditorUtil.getSelectedEditor(project);
|
||||
if (mainEditor != null) {
|
||||
EditorUtil.replaceEditorSelection(
|
||||
mainEditor,
|
||||
requireNonNull(toolWindowEditor.getSelectionModel().getSelectedText()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,10 @@ public class ReplaceSelectionAction extends TrackableAction {
|
|||
public void handleAction(@NotNull AnActionEvent event) {
|
||||
var project = requireNonNull(event.getProject());
|
||||
if (EditorUtil.isMainEditorTextSelected(project)) {
|
||||
EditorUtil.replaceEditorSelection(editor, editor.getDocument().getText());
|
||||
var mainEditor = EditorUtil.getSelectedEditor(project);
|
||||
if (mainEditor != null) {
|
||||
EditorUtil.replaceEditorSelection(mainEditor, editor.getDocument().getText());
|
||||
}
|
||||
} else {
|
||||
OverlayUtil.showSelectedEditorSelectionWarning(event);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue