Currently when copy-pasting logs on Firefox, an extra newline is added to each line. This is related to the CSS property user-select: none (and browser-specific variants) that is attached to the line number span to the left of each log line. This PR removes the CSS property which fixes the issue. Fixes #875.
There is a slight regression on Safari in that the line numbers now have the appearance of being partially selected along with the log lines, however the line numbers themselves (which are ::before pseudo-elements) are not copied and the pasting behaviour is as expected. It appears that when selecting text in Safari, the containing element is highlighted rather than the text itself. As it makes no functional difference, I'll let it be.
In Chrome and Safari, copy-pasted logs do not include a space between paragraphs (i.e. two newlines) when they should. Firefox currently does include this. As a fix, this PR replaces empty log lines with newline characters which creates the correct behaviour in Chrome and Safari. In Firefox there are now two spaces between each paragraph, but I would rather have two spaces than no spaces so I include this fix.
Correct paragraph behaviour; Firefox pre-fix and Chrome and Safari post-fix:
This PR fixes two issues:
user-select: none
(and browser-specific variants) that is attached to the line numberspan
to the left of each log line. This PR removes the CSS property which fixes the issue. Fixes #875.There is a slight regression on Safari in that the line numbers now have the appearance of being partially selected along with the log lines, however the line numbers themselves (which are
::before
pseudo-elements) are not copied and the pasting behaviour is as expected. It appears that when selecting text in Safari, the containing element is highlighted rather than the text itself. As it makes no functional difference, I'll let it be.Correct paragraph behaviour; Firefox pre-fix and Chrome and Safari post-fix:
Incorrect behaviour; Chrome and Safari pre-fix:
Incorrect behaviour; Firefox post-fix:
Tested on Macos M1, on Chrome (117.0.5938.92), Firefox (117.0.1), and Safari (15.6.1).