On Fri, 28 Mar 2025 20:22:39 GMT, Kevin Rushforth <k...@openjdk.org> wrote:

>> Option 1 is intentionally the status quo, and matches what Swing's 
>> JComponent does, although @mstr2 is right that this isn't documented. An RFE 
>> to treat `\r` or `\r\n` as a newline could be considered in the future. We 
>> wouldn't do that as part of this PR.
>> 
>> So for _this_ PR, the question is what characters should be elided for the 
>> prompt text of a `TextField` so that multiple lines as a single line? 
>> Limiting this to stripping `\n` is sufficient given the current 
>> implementation, unless and until something else changes. Also, it matches 
>> what the existing implementation tries to do when it modifies the actual 
>> property value.
>
> One thing I am curious about: I don't see a similar stripping of newlines in 
> the text itself for TextField, and yet it does render the whole string as if 
> the newline had been stripped. Do you know why we need to strip it from 
> promptTextProperty explicitly and not from textProperty?

@kevinrushforth 
This is due to `TextFieldContent::insert` we have a filterInput and the second 
parameter to strip newlines is set to true in the textField class.
`filterInput(String txt, boolean stripNewlines, boolean stripTabs)`
For `TextAreaContent::insert` the parameter is set to false to allow newlines.

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

PR Review Comment: https://git.openjdk.org/jfx/pull/1716#discussion_r2031472786

Reply via email to