Copy/paste issues with diffs #1835

Closed
opened 2025-11-02 04:14:41 -06:00 by GiteaMirror · 3 comments
Owner

Originally created by @silverwind on GitHub (May 29, 2018).

Copying content from a diff like this, I see inconsistent behaviour between browsers.

Firefox copies double newlines:

    claims := jwt.MapClaims{

      "repo": repo.ID,

      "op":   lfsVerb,

-     "exp":  now.Add(5 * time.Minute).Unix(),

+     "exp":  now.Add(setting.LFS.HTTPAuthExpiry).Unix(),

      "nbf":  now.Unix(),

    }

    if user != nil {

Safari copies line numbers:


claims := jwt.MapClaims{
--
269 | 269 | "repo": repo.ID,
270 | 270 | "op":   lfsVerb,
271 |   | -			"exp":  now.Add(5 * time.Minute).Unix(),
  | 271 | +			"exp":  now.Add(setting.LFS.HTTPAuthExpiry).Unix(),
272 | 272 | "nbf":  now.Unix(),
273 | 273 | }
274 | 274 | if user != nil {

Chrome seems alright:

    claims := jwt.MapClaims{
      "repo": repo.ID,
      "op":   lfsVerb,
-     "exp":  now.Add(5 * time.Minute).Unix(),
+     "exp":  now.Add(setting.LFS.HTTPAuthExpiry).Unix(),
      "nbf":  now.Unix(),
    }
    if user != nil {

I will probably attempt a fix later, but feel free to contribute as well.

Originally created by @silverwind on GitHub (May 29, 2018). Copying content from a diff like [this](https://try.gitea.io/go-gitea/gitea/commit/15f6ec96327d69d19fcce937811214e113341f58), I see inconsistent behaviour between browsers. Firefox copies double newlines: ```` claims := jwt.MapClaims{ "repo": repo.ID, "op": lfsVerb, - "exp": now.Add(5 * time.Minute).Unix(), + "exp": now.Add(setting.LFS.HTTPAuthExpiry).Unix(), "nbf": now.Unix(), } if user != nil { ```` Safari copies line numbers: ```` claims := jwt.MapClaims{ -- 269 | 269 | "repo": repo.ID, 270 | 270 | "op": lfsVerb, 271 |   | - "exp": now.Add(5 * time.Minute).Unix(),   | 271 | + "exp": now.Add(setting.LFS.HTTPAuthExpiry).Unix(), 272 | 272 | "nbf": now.Unix(), 273 | 273 | } 274 | 274 | if user != nil { ```` Chrome seems alright: ```` claims := jwt.MapClaims{ "repo": repo.ID, "op": lfsVerb, - "exp": now.Add(5 * time.Minute).Unix(), + "exp": now.Add(setting.LFS.HTTPAuthExpiry).Unix(), "nbf": now.Unix(), } if user != nil { ```` I will probably attempt a fix later, but feel free to contribute as well.
GiteaMirror added the topic/uiissue/confirmedtype/bug labels 2025-11-02 04:14:41 -06:00
Author
Owner

@Larivact commented on GitHub (Jan 23, 2019):

For Firefox it can be fixed by replacing the <pre> tags in the <td class="lines-code "> cells with <div style="white-space:pre">.

@Larivact commented on GitHub (Jan 23, 2019): For Firefox it can be fixed by replacing the `<pre>` tags in the `<td class="lines-code ">` cells with `<div style="white-space:pre">`.
Author
Owner

@silverwind commented on GitHub (Jan 23, 2019):

Related here: The + and - from a diff should not be copied. It can be done by using CSS pseudo elements with user-select: none.

@silverwind commented on GitHub (Jan 23, 2019): Related here: The `+` and `-` from a diff should not be copied. It can be done by using CSS pseudo elements with `user-select: none`.
Author
Owner

@stale[bot] commented on GitHub (Mar 24, 2019):

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

@stale[bot] commented on GitHub (Mar 24, 2019): This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#1835