From c413bef11dd83b9489dc4d70d797df2d745bcddd Mon Sep 17 00:00:00 2001 From: Ana Gelez Date: Tue, 2 Apr 2024 14:16:00 +0200 Subject: Never shrink lines in raw blocks (#3796) --- tests/ref/layout/code-indent-shrink.png | Bin 0 -> 8232 bytes tests/typ/layout/code-indent-shrink.typ | 28 ++++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 tests/ref/layout/code-indent-shrink.png create mode 100644 tests/typ/layout/code-indent-shrink.typ (limited to 'tests') diff --git a/tests/ref/layout/code-indent-shrink.png b/tests/ref/layout/code-indent-shrink.png new file mode 100644 index 00000000..26f6ec40 Binary files /dev/null and b/tests/ref/layout/code-indent-shrink.png differ 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 -- cgit v1.2.3