From f8871969fdb2df6019ede87a73b2feca1a5ef90a Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Tue, 11 Jan 2022 10:50:29 +0000 Subject: [PATCH] Fix wrongly wrapping code blocks, breaking line numbers (#7507) --- res/css/views/rooms/_EventTile.scss | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/res/css/views/rooms/_EventTile.scss b/res/css/views/rooms/_EventTile.scss index 1de668985f6..5abc86f3df4 100644 --- a/res/css/views/rooms/_EventTile.scss +++ b/res/css/views/rooms/_EventTile.scss @@ -483,8 +483,17 @@ $left-gutter: 64px; background-color: $codeblock-background-color; } - pre code > * { - display: inline; + // this selector wrongly applies to code blocks too but we will unset it in the next one + code { + white-space: pre-wrap; // don't collapse spaces in inline code blocks + } + + pre code { + white-space: pre; // we want code blocks to be scrollable and not wrap + + > * { + display: inline; + } } pre { @@ -498,10 +507,6 @@ $left-gutter: 64px; background: transparent; } } - - code { - white-space: pre-wrap; // don't collapse spaces in inline code blocks - } } .mx_EventTile_lineNumbers {