From 622cef8e0052532e9b71f7a2484e6637095b9b79 Mon Sep 17 00:00:00 2001 From: bluebear94 Date: Sat, 24 Jun 2023 08:26:06 -0400 Subject: [PATCH] layout::par::collect: Treat linebreak element as whitespace (#1542) Fixes #1540. --- library/src/layout/par.rs | 5 ++++- tests/ref/bugs/smartquotes-on-newline.png | Bin 0 -> 1625 bytes tests/typ/bugs/smartquotes-on-newline.typ | 7 +++++++ 3 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 tests/ref/bugs/smartquotes-on-newline.png create mode 100644 tests/typ/bugs/smartquotes-on-newline.typ diff --git a/library/src/layout/par.rs b/library/src/layout/par.rs index 6170a34d8..2d6bd96d2 100644 --- a/library/src/layout/par.rs +++ b/library/src/layout/par.rs @@ -609,7 +609,10 @@ fn collect<'a>( elem.text().chars().next() } else if child.is::() { Some('"') - } else if child.is::() || child.is::() { + } else if child.is::() + || child.is::() + || child.is::() + { Some(SPACING_REPLACE) } else { Some(OBJ_REPLACE) diff --git a/tests/ref/bugs/smartquotes-on-newline.png b/tests/ref/bugs/smartquotes-on-newline.png new file mode 100644 index 0000000000000000000000000000000000000000..fdf4623ad0faee8e0b217c1a40f45378c4b598fc GIT binary patch literal 1625 zcma)-c{tPw7{`Azq*09=Lkz<(C~~xJO3oo+jMBPtJ#B={5LVVTW`0bK6sfji9BbBn zpE+YRYY2m>7GuJOT?)z3x@y_&+2`4P_K$s@@AE$2f8KvS&-;Adn|Pcp`~dO*003~i zGuGz-03x{C^I^LKu!EcF0e}$N&f3D|`q;vFu*3aGxsK%kD*Mn^`>?n4xW{S(-Tfa0 z>T8n@(3J9K_4|2QzrZC!JdCj6A+su26-n*HhnCguf{)4M#G zK?_kqb5Xzo5QKaw5v0&9j(V)*e+b5enG;}1?#PrtqBMAWBo{@XukOq&)ZnIj}J)g0@@L@qnI}VSd zv(jK{V@&!o?~O<&F6vI8inO>Qj@QMd*|ao1@ihW*=FNd}z(uqD?w{kq`n;i4$_a+C znWhJwE$aC$LCimRcwUZUE2pazcN^g#)#9kD#TQx{IiE-%WL>T1@Q4& z%Mx@}p!EEbRexpJ#Jdv$cMP}PZgYF^SkYa+|HS(@=YJOz`o#oQeGhwp)dzxzqb;8( zlZCTMPr{L@&^+?dvl zIa2sIKGgAsoCV-o|%!FT;2!*f@*5i zr#jONW@hd{ka&g!SRHc8%Bt3n-*I6{q=ZuE>e?5{8$diQ$jg&4qRSIXsv4;GJu1&! zX+-!h>Q6_~&)!iRx>Y!}Kmn8~C@OB+UX5)bMmh1F+PlNv zYHKD?lRTzZ&75~>4+o~KBr+?zSyJTah4G=46;g|?RCd?gH$_T&#z4bJXn+jBpkK<9 z)68=C)A%^Pkjho;$T?~{ zYd0GMV8);i)Q@4)aiU~TgM~FeRmQ&5nBdc)Q#&`zb0}bA&~T|M(kMs70Kc`J9RZ^hZi@2-@q7`!MihWexr(H@(T*sjMC^ow;ux_MRH$8j&9fR&AVV~_J?Aj*o z`=B9`9%g{wh@;92ox^;0%PH}s1T_hc6Vgf$&$_|wIkjto|8=b3=dj0riCWos)Xd{U Ub3l~5C-cvrfyG%@So)Ix0Kc2no&W#< literal 0 HcmV?d00001 diff --git a/tests/typ/bugs/smartquotes-on-newline.typ b/tests/typ/bugs/smartquotes-on-newline.typ new file mode 100644 index 000000000..3180350ea --- /dev/null +++ b/tests/typ/bugs/smartquotes-on-newline.typ @@ -0,0 +1,7 @@ +// Test that smart quotes are inferred correctly across newlines. + +--- +"test"#linebreak()"test" + +"test"\ +"test"