Skip to content

New line automatically inserted when using copy button #99

@fridde

Description

@fridde

When using the "Copy to clipboard" button on a page for a single-package an extra "\n" (new line) character is appended to that command.

Pasting this command into a command line will automatically execute that command. Maybe this is intended behaviour, but a lot of terminals ask the user to confirm that multiple-lines will be pasted into the command line, so an extra step and some suprise is added.

I am not too familiar with the template language used in fastify, but I guess the new line comes from the carriage return on this line (before {Package.Id}).

Either the generateClipboard function should trim its input or (if the template language supports this) {- Package.Id -}should be used (I am paraphrasing from Twig, where {- means "trim whitespace before this variable").

Example: On https://winget.run/pkg/Audacity/Audacity below "How to install" the copy button next to > winget install -e --id Audacity.Audacity will actually copy winget install -e --id Audacity.Audacity\n

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions