From 8518e4cedcfcb2a5c46c244d28a48208f91be561 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Wed, 13 Jul 2016 23:31:26 +0200 Subject: Fix missing empty lines in chromium when copying code Chromium apparently requires a
or some text to be present for a line to be copied to the clipboard. Firefox interprets the \n at the end as line break and copies that if there is no content. Adding an explicit
makes chromium work correctly, but firefox still converts the \n. Fix this by putting the \n in an HTML comment. That way the output is still somewhat readable, but both browsers do the correct thing. Signed-off-by: Florian Pritz --- application/controllers/file.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/application/controllers/file.php b/application/controllers/file.php index e1196940c..139496eb9 100644 --- a/application/controllers/file.php +++ b/application/controllers/file.php @@ -293,13 +293,17 @@ class File extends MY_Controller { $anchor = "n-$anchor_id-$line_number"; } + if ($line === "") { + $line = "
"; + } + // Be careful not to add superflous whitespace here (we are in a ) $output .= "
" ."" ." " ."" - ."".$line."\n"; - $output .= "
"; + ."".$line.""; } $output .= "
"; -- cgit v1.2.3-24-g4f1b