IDEA-93637 Hide cursor while typing

This commit is contained in:
Dmitry Batrak
2016-08-12 14:47:39 +03:00
parent 85d5426026
commit d748ccb9b6
@@ -147,8 +147,21 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
private final TraceableDisposable myTraceableDisposable = new TraceableDisposable(true);
private int myLinePaintersWidth;
private static final Cursor EMPTY_CURSOR;
static {
ComplementaryFontsRegistry.getFontAbleToDisplay(' ', 0, Font.PLAIN, UIManager.getFont("Label.font").getFamily()); // load costly font info
Cursor emptyCursor = null;
try {
emptyCursor = Toolkit.getDefaultToolkit().createCustomCursor(UIUtil.createImage(1, 1, BufferedImage.TYPE_INT_ARGB),
new Point(),
"Empty cursor");
}
catch (Exception e){
LOG.warn("Couldn't create an empty cursor", e);
}
EMPTY_CURSOR = emptyCursor;
}
private final CommandProcessor myCommandProcessor;
@@ -1981,6 +1994,10 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
(getCaretModel().getOffset() < e.getOffset() || getCaretModel().getOffset() > e.getOffset() + e.getNewLength())) {
restoreCaretRelativePosition();
}
if (EMPTY_CURSOR != null) {
myEditorComponent.setCursor(EMPTY_CURSOR);
}
}
private void saveCaretRelativePosition() {