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

Copy/Paste ommitting newlines (again) #19331

Closed
silverwind opened this issue Apr 5, 2022 · 3 comments · Fixed by #19798 or #19967
Closed

Copy/Paste ommitting newlines (again) #19331

silverwind opened this issue Apr 5, 2022 · 3 comments · Fixed by #19798 or #19967
Labels
issue/regression Indicates a previously functioning feature or behavior that has broken or regressed after a change type/bug

Comments

@silverwind
Copy link
Member

silverwind commented Apr 5, 2022

STR:

  1. Open https://try.gitea.io/silverwind/symlink-test/src/branch/master/.drone.yml
  2. Select the first 5 lines of code
  3. Copy the code to clipboard
  4. Paste it somewhere
  5. Observe that empty line 4 is not copied

I recall a6168fa, which ought to have fixed this but it must have regressed recently and 1.16 is also affected. I do not see a literal newline in the HTML on these empty lines anymore while there should be one.

@silverwind silverwind added type/bug issue/regression Indicates a previously functioning feature or behavior that has broken or regressed after a change labels Apr 5, 2022
@lunny
Copy link
Member

lunny commented Apr 8, 2022

We need a test to prevent that.

@silverwind
Copy link
Member Author

Pretty sure the issue is coming from modules/highlight and it should be pretty easy to add/modify a test there to include empty lines.

silverwind added a commit to silverwind/gitea that referenced this issue May 24, 2022
Fixes: go-gitea#19331
Regressed by: go-gitea#18270

Needed to do another newline addition to the Chroma output HTML to get
copy/paste work again. The previous replacement conditions are probably
obsolete, but as I'm not 100% sure, I opted to keep them.

Specifically, the Chroma HTML change mentioned in
go-gitea#18270 (comment)
broke our previous newline replacement for such empty lines.

Also included are a few changes to make the test more pleasant to work
with.
lunny added a commit that referenced this issue Jun 10, 2022
* Fix copy/paste of empty newlines again

Fixes: #19331
Regressed by: #18270

Needed to do another newline addition to the Chroma output HTML to get
copy/paste work again. The previous replacement conditions are probably
obsolete, but as I'm not 100% sure, I opted to keep them.

Specifically, the Chroma HTML change mentioned in
#18270 (comment)
broke our previous newline replacement for such empty lines.

Also included are a few changes to make the test more pleasant to work
with.

* run go mod tidy

* add util.Dedent

* copy in the code

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Lauris BH <lauris@nix.lv>
@silverwind
Copy link
Member Author

Seems there is still some issue with YAML files at least, it does work correctly with JS files, very weird.

@silverwind silverwind reopened this Jun 14, 2022
silverwind added a commit to silverwind/gitea that referenced this issue Jun 14, 2022
Fixes: go-gitea#19331

Followup to go-gitea#19798. Trim off both the .line and .cl classes from Chroma's HTML which made the old conditional work again. This fixed Copy of YAML files for me while also reducing the amount of rendered HTML nodes.
AbdulrhmnGhanem pushed a commit to kitspace/gitea that referenced this issue Aug 24, 2022
* Fix copy/paste of empty newlines again

Fixes: go-gitea#19331
Regressed by: go-gitea#18270

Needed to do another newline addition to the Chroma output HTML to get
copy/paste work again. The previous replacement conditions are probably
obsolete, but as I'm not 100% sure, I opted to keep them.

Specifically, the Chroma HTML change mentioned in
go-gitea#18270 (comment)
broke our previous newline replacement for such empty lines.

Also included are a few changes to make the test more pleasant to work
with.

* run go mod tidy

* add util.Dedent

* copy in the code

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Lauris BH <lauris@nix.lv>
@go-gitea go-gitea locked and limited conversation to collaborators May 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
issue/regression Indicates a previously functioning feature or behavior that has broken or regressed after a change type/bug
Projects
None yet
2 participants