You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@netbeans.apache.org by GitBox <gi...@apache.org> on 2017/12/19 09:37:19 UTC

[GitHub] geertjanw closed pull request #296: #269262 - [Regression] The editor screen is not scrolled with a keyboard after Japanese strings are input using IME

geertjanw closed pull request #296: #269262 - [Regression] The editor screen is not scrolled with a keyboard after Japanese strings are input using IME
URL: https://github.com/apache/incubator-netbeans/pull/296
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/editor.lib2/src/org/netbeans/api/editor/caret/EditorCaret.java b/editor.lib2/src/org/netbeans/api/editor/caret/EditorCaret.java
index ac3b56492..64ffd85bd 100644
--- a/editor.lib2/src/org/netbeans/api/editor/caret/EditorCaret.java
+++ b/editor.lib2/src/org/netbeans/api/editor/caret/EditorCaret.java
@@ -1889,9 +1889,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
@@ -1923,6 +1932,11 @@ private void dispatchUpdate(boolean forceInvokeLater) {
                         } finally {
                             doc.readUnlock();
                         }
+                    } else {
+                        // #269262 avoid that update() is not invoked
+                        synchronized (listenerList) {
+                            caretUpdatePending = false;
+                        }
                     }
                 }
             };


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@netbeans.incubator.apache.org
For additional commands, e-mail: dev-help@netbeans.incubator.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists