Skip to content

applets/clipboard: don't delete final character of each line in multiline preview

In the Klipper/clipboard applet, when you view the popup which shows the contents of the clipboard history, there is an issue rendering multiline strings.

When rendering multilinestrings, the final character of each line (except the last) is deleted.

So a string like

hello
there
world

becomes

hell
ther
world

This is due to a bad regex, which this fixes.

This is actually slightly worse than it seems, since this includes removing the last character of escaped HTML codes, e.g. if you copy

some&
text

the & is escaped to & but then the semicolon is lost, yielding

some&amp
text

Which is invalid and breaks the rendering.

Merge request reports