On Fri, 2 Oct 2026 05:31:17 GMT, Robert Lichtenberger <[email protected]> 
wrote:

>> As analysed in the bug, the previousWord() method does not work correctly if 
>> at the word boundary a character is found that is neither letter nor digit.
>> This fix changes the method so that only ranges of whitespace will be 
>> skipped, resulting in correct word selection behaviour.
>> A test case has been added to TextAreaTest.
>> gradlew :controls:test --tests test.javafx.scene.control.Text*Test has been 
>> executed to ensure no regressions happen in other text related classes. No 
>> errors were reported.
>> 
>> 
>> ---------
>> - [X] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Robert Lichtenberger has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   8264588: Remove extra newline, Put @Test annotation on separate line.

Tried a few other editors (kate, gedit, eclipse). It is astonishing how many 
different behaviours are out there concerning double-click on non-word 
characters ;-). And every one I tested has some "quirks" that I do not agree 
with.
Here's what I would suggest as an "algorithm":
- There's three character classes: wordpart (letters, digits), whitespace, other
- Double clicking on a character will select everything of the same character 
class around the click, resulting in:

bug #1|23    ->  bug #[123]
aaa.3|x3     ->  aaa.[3x3]
aaa |bbb     ->  aaa [bbb]
aaa,|,,bbb   ->  aaa[,,,]bbb
aaa  |  bbb  ->  aaa[    ]bbb
aaa\t|\t\tbbb ->  aaa[\t\t\t]bbb

This assumes that | here indicated that the character _after_ the | is clicked.

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

PR Comment: https://git.openjdk.org/jfx/pull/2334#issuecomment-5947346794

Reply via email to