Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copying code to clipboard omits empty lines in some files #16434

Closed
silverwind opened this issue Jul 15, 2021 · 1 comment · Fixed by #16678
Closed

Copying code to clipboard omits empty lines in some files #16434

silverwind opened this issue Jul 15, 2021 · 1 comment · Fixed by #16678
Labels
topic/ui Change the appearance of the Gitea UI type/bug

Comments

@silverwind
Copy link
Member

silverwind commented Jul 15, 2021

On some files like https://try.gitea.io/silverwind/symlink-test/src/branch/master/.drone.yml copying to clipboard via text selection omits emty lines in the copied content. The HTML of those empty lines does not render anything and I think we'd need to render a newline character for such empty lines so browser selection can properly pick it up. The issue does not show in all files and I think it's somehow caused by the yaml syntax highlighting.

On gitea (no newline character):

<code class="code-inner"><span class="w"></span></code>

On github (with newline character):

<td id="LC4" class="blob-code blob-code-inner js-file-line">
</td>
@silverwind silverwind added type/bug topic/ui Change the appearance of the Gitea UI labels Jul 15, 2021
@silverwind
Copy link
Member Author

silverwind commented Jul 15, 2021

Also of note, in diff view it works fine and the newline is there. Also there is no empty w span introduced by syntax highlighting which may be the culprit.

<code class="code-inner">
</code>

zeripath added a commit to zeripath/gitea that referenced this issue Aug 12, 2021
When files are highlighted the newline character needs to be added in a whitespace
compliant mode. Also ensure the final empty newline is rendered.

Fix go-gitea#16434

Signed-off-by: Andrew Thornton <[email protected]>
6543 pushed a commit that referenced this issue Aug 13, 2021
* Ensure empty lines are copiable and final new line too

When files are highlighted the newline character needs to be added in a whitespace
compliant mode. Also ensure the final empty newline is rendered.

Fix #16434

* Add test and ensure spans closed

Signed-off-by: Andrew Thornton <[email protected]>
zeripath added a commit to zeripath/gitea that referenced this issue Aug 14, 2021
Backport go-gitea#16678

When files are highlighted the newline character needs to be added in a whitespace
compliant mode. Also ensure the final empty newline is rendered.

Fix go-gitea#16434

Signed-off-by: Andrew Thornton <[email protected]>
6543 pushed a commit that referenced this issue Aug 15, 2021
Backport #16678

When files are highlighted the newline character needs to be added in a whitespace
compliant mode. Also ensure the final empty newline is rendered.

Fix #16434

Signed-off-by: Andrew Thornton <[email protected]>
Codeberg-org pushed a commit to Codeberg-org/gitea that referenced this issue Aug 24, 2021
… (go-gitea#16692)

Backport go-gitea#16678

When files are highlighted the newline character needs to be added in a whitespace
compliant mode. Also ensure the final empty newline is rendered.

Fix go-gitea#16434

Signed-off-by: Andrew Thornton <[email protected]>
@go-gitea go-gitea locked and limited conversation to collaborators Oct 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
topic/ui Change the appearance of the Gitea UI type/bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant