summaryrefslogtreecommitdiff
path: root/tests/typ/layout
diff options
context:
space:
mode:
authorAna Gelez <ana@gelez.xyz>2024-04-02 14:16:00 +0200
committerGitHub <noreply@github.com>2024-04-02 12:16:00 +0000
commitc413bef11dd83b9489dc4d70d797df2d745bcddd (patch)
tree74ca845de2cb07b015d087f498fee4b352aefb04 /tests/typ/layout
parentc225adb22bb6a445f1cf7f0261e9a937ce397988 (diff)
Never shrink lines in raw blocks (#3796)
Diffstat (limited to 'tests/typ/layout')
-rw-r--r--tests/typ/layout/code-indent-shrink.typ28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/typ/layout/code-indent-shrink.typ b/tests/typ/layout/code-indent-shrink.typ
new file mode 100644
index 00000000..1527e061
--- /dev/null
+++ b/tests/typ/layout/code-indent-shrink.typ
@@ -0,0 +1,28 @@
+// Spaces in raw blocks should not be shrunk
+// as it would mess up the indentation of code
+// https://github.com/typst/typst/issues/3191
+
+---
+#set par(justify: true)
+
+#show raw.where(block: true): block.with(
+ fill: luma(240),
+ inset: 10pt,
+)
+
+#block(
+ width: 60%,
+ ```py
+ for x in xs:
+ print("x=",x)
+ ```
+)
+
+---
+// In normal paragraphs, spaces should still be shrunk.
+// The first line here serves as a reference, while the second
+// uses non-breaking spaces to create an overflowing line
+// (which should shrink).
+~~~~No shrinking here
+
+~~~~The~spaces~on~this~line~shrink \ No newline at end of file