On Wed, 26 Mar 2025 14:11:34 GMT, Michael Strauß <mstra...@openjdk.org> wrote:
>> The tests show that only LF "\n" is rendered as a new line, there is no need >> to add more restrictions that is not needed >> and the same was tested by @andy-goryachev-oracle previously in the comments >> and it confirms the same. > > That doesn't sound like a compelling reason to me. In fact, it makes it seems > like a bug in JavaFX that a line break is only rendered with `\n`, but not > with `\r\n` or `\r`. > > In any case, the goal here is to (semantically) transform a string such that > it doesn't contain line breaks, and line breaks come in three different usual > forms. Our goal should always be to do the right thing, and not stop half-way > and rely on unspecified rendering quirks for the rest. 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. ------------- PR Review Comment: https://git.openjdk.org/jfx/pull/1716#discussion_r2019136526