Skip to content
Permalink
Browse files

#269262 - [Regression] The editor screen is not scrolled with a keybo…

…ard after Japanese strings are input using IME
  • Loading branch information...
junichi11 committed Oct 28, 2017
1 parent 32fad90 commit 8b67a74152c74f837b50ce592dcfa55e3766f162
Showing with 15 additions and 1 deletion.
  1. +15 −1 editor.lib2/src/org/netbeans/api/editor/caret/EditorCaret.java
@@ -1850,9 +1850,18 @@ private void modelChanged(Document oldDoc, Document newDoc) {
newAtomicDoc.addAtomicLockListener(listenerImpl);
}

// #269262 when IME is used, deinstall and install method is invoked
// so in such case, the existing position shoud be used
// because newDoc.StartPosition() may be an incorrect position
CaretInfo lastCaret = getLastCaret();
Position dotPos = lastCaret.getDotPosition();
if (dotPos == null) {
dotPos = newDoc.getStartPosition();
}

// Set caret to zero position upon document change (DefaultCaret impl does this too)
runTransaction(CaretTransaction.RemoveType.REMOVE_ALL_CARETS, 0,
new CaretItem[] { new CaretItem(this, newDoc.getStartPosition(), Position.Bias.Forward,
new CaretItem[] { new CaretItem(this, dotPos, Position.Bias.Forward,
null, Position.Bias.Forward ) }, null);

// Leave caretPos and markPos null => offset==0
@@ -1884,6 +1893,11 @@ private void dispatchUpdate(boolean forceInvokeLater) {
} finally {
doc.readUnlock();
}
} else {
// #269262 avoid that update() is not invoked
synchronized (listenerList) {
caretUpdatePending = false;
}
}
}
};

0 comments on commit 8b67a74

Please sign in to comment.
You can’t perform that action at this time.