On Mon, 9 Nov 2026 20:12:50 GMT, Andy Goryachev <[email protected]> wrote:

>> Robert Lichtenberger has updated the pull request incrementally with two 
>> additional commits since the last revision:
>> 
>>  - Update 
>> modules/javafx.controls/src/main/java/com/sun/javafx/scene/control/behavior/TextAreaBehavior.java
>>    
>>    Co-authored-by: Marius Hanl <[email protected]>
>>  - Update 
>> modules/javafx.controls/src/main/java/com/sun/javafx/scene/control/behavior/TextAreaBehavior.java
>>    
>>    Co-authored-by: Marius Hanl <[email protected]>
>
> modules/javafx.controls/src/main/java/com/sun/javafx/scene/control/behavior/TextAreaBehavior.java
>  line 422:
> 
>> 420:         } else if (pos < textArea.getLength()) {
>> 421:             String text = textArea.getText();
>> 422:             atWordStart = Character.isWhitespace(text.charAt(pos - 1)) 
>> && !Character.isWhitespace(text.charAt(pos));
> 
> there are a few whitespace chars that Character.isWhitespace() return false:
> 
> 
> NEXT_LINE \u0085
> NO_BREAK_SPACE \u00a0
> FIGURE_SPACE \u2007
> NARROW_NO_BREAK_SPACE \u202f
> 
> 
> the no-break space chars we probably shouldn't consider as breaking;
> `NEXT_LINE` - having this in TextInputControl makes no sense
> but what about `FIGURE_SPACE` ?
> 
> or should we use `Character.isWhitespace() || Character.isSpaceChar()` ?

I agree with the `Character.isWhitespace() || Character.isSpaceChar()` idea. It 
will work with all the above characters except `NEXT_LINE \u0085`.
Considering the other chars mentioned above:
* NO_BREAK_SPACE is a space character that only prevent line breaks, so double 
clicking on `bbb` in `aaa\u00a0bbb` should definitely select `bbb`.
* FIGURE_SPACE is just a space with special width so yes it will separate words.
* NARROW_NO_BREAK_SPACE is like a NO_BREAK_SPACE only narrower.
I will add tests for these cases and adapt the `atWordStart` logic.

-------------

PR Review Comment: https://git.openjdk.org/jfx/pull/2363#discussion_r4667633959

Reply via email to