Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8074882

Support 'replacement range' feature in the Input Method API

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P3 P3
    • tbd
    • 8, 9, 10
    • client-libs
    • generic
    • generic

      The 'replacement range' is the range in the committed document text which should be replaced with the InputMethod composed text.
      This feature exists in the MacOS Cocoa IM API and is used for press-and-hold input:
      e.g. when the 'e' key is pressed and hold for some time the input method is activated to select a accented variant. In this case Cocoa sends the regular keyDown event for 'e' character, and then setMarkedText event which has a Replacement parameter containing the NSRange of the last entered character (which should be replaced).
      The root problem is that 'replacement range' can't be delivered to the custom text components (see JDK-8073194 for details).

      This feature can be useful independently of the underlying platform as well. For example IM with auto-completion feature when IM aims to replace already entered text part.

      The proposed API changes are below:

      Add two int fields to the InputMethodEvent: replaceStartPos, replaceEndPos + according constructor(s) and getters

      Add to the java.awt.im.spi.InputMethodContext interface the method dispatchInputMethodEvent with the corresponding 2 arguments.
      The latter interface change is optional for the purpose of using the native IMs, but is required for implementing Java IMs with the 'replacement range' feature.

            Unassigned Unassigned
            anashaty Anton Nashatyrev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: