LibGfx: Treat "\r\n" as a single line break during text layout

We currently insert two line breaks for this sequence. This Windows-
style of line breaking can be seen in documents on the web.
This commit is contained in:
Timothy Flynn 2024-03-08 09:33:06 -05:00 committed by Tim Flynn
parent 4bdb7dba8c
commit d9349f1510
Notes: sideshowbarker 2024-07-18 03:35:30 +09:00

View file

@ -73,8 +73,11 @@ Vector<ByteString, 32> TextLayout::wrap_lines(TextElision elision, TextWrapping
continue;
}
case '\n':
case '\r': {
case '\r':
if (it.peek(1) == static_cast<u32>('\n'))
++it;
[[fallthrough]];
case '\n': {
if (current_block_type.has_value()) {
blocks.append({
current_block_type.value(),