Skip to content

Commit

Permalink
Merge branch 'stable' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
mindolph committed May 21, 2023
2 parents 4f02ca9 + dc07f74 commit 287155b
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import javafx.scene.input.KeyEvent;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.SystemUtils;
import org.fxmisc.richtext.CaretSelectionBind;
import org.fxmisc.richtext.CodeArea;
import org.fxmisc.richtext.model.Paragraph;
Expand Down Expand Up @@ -134,10 +135,14 @@ public void addFeatures(FEATURE... features) {
default:
break;
}
// disable PASTE shortcut to avoid conflict with global.
inputMaps.add(InputMap.consume(
EventPattern.keyPressed(sm.getKeyCombination(KEY_EDITOR_PASTE)), Event::consume
));
// somehow on macOS, the shortcut event not only consumed by editor, but also consumed by application,
// which causes the paste action be performed twice.
// so disable PASTE shortcut on macOS to avoid conflict with global.
if (SystemUtils.IS_OS_MAC) {
inputMaps.add(InputMap.consume(
EventPattern.keyPressed(sm.getKeyCombination(KEY_EDITOR_PASTE)), Event::consume
));
}
Nodes.addInputMap(this, InputMap.sequence(inputMaps.toArray(new InputMap[]{})));
}
}
Expand Down

0 comments on commit 287155b

Please sign in to comment.