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

Wrong visual caret position in TextField after text replacement

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3
    • 9
    • 8u51
    • javafx
    • x86
    • windows_8

    Description

      FULL PRODUCT VERSION :
      java version "1.8.0_51"
      Java(TM) SE Runtime Environment (build 1.8.0_51-b16)
      Java HotSpot(TM) Client VM (build 25.51-b03, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 6.3.9600]

      A DESCRIPTION OF THE PROBLEM :
      When TextField contains exactly one character, double click TextField to select text.
      Replace text with one character string.
      TextField caret will be visualy positioned at position 0 (to the left of the text). Actually caret wil be to the right of the text.
      Then if you press "Delete" key text will not be deleted. If you press "Right" key caret will not move. But if you press "Backspace" key text will be deleted.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Click TextField to focus it.
      2. Press 'a' key to change TextField text to string of length 1 (or paste string of length 1)
      3. Double click TextField to the right of text on empty part of control (important) to select text.
       When selecting text with keyboard or ctrl+'A' hot-key bug is not reproduced.
      4. Replace text with string of length 1: either press 'a' or paste string of length 1.


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Text replaced, caret visualy positioned to the right of the text.
      ACTUAL -
      Text replaced, caret visualy positioned to the LEFT of the text.
      Actual position used by control is right, but CaretPath shape positioned wrongly.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      public class Main extends Application {

          @Override
          public void start(Stage primaryStage) throws Exception {
              primaryStage.setScene(new Scene(new TextField()));
              primaryStage.show();
          }
          public static void main(String[] args) {
              launch(args);
          }
      }
      ---------- END SOURCE ----------

      Attachments

        Activity

          People

            leifs Leif Samuelsson (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: