Filter = prune or fix?

Do the line ending filters aim to prune or fix ?

I think I am perhaps misinterpreting what this aims to do:

Reading the help file on filters, I had equated this with item 2 of the list of filters there:

Set line endings to Mac, Unix or Windows/DOS.

and so, this morning, when I found that copy-pasting some lines of code from a PDF

was giving me Old Mac (CR) line endings,

which were choking a compiler, I reached for a KM Filter Clipboard action, and set the options to with: Unix Line Endings

The result was not quite what I had expected:

Line breaks seem to have been filtered out (deleted) rather than fixed (translated to LF characters).

Is that behaviour by design, or am I slightly misreading what is really happening ?


Before and after, seen in Vim editing buffers
The copy paste from PDF contains Ctrl M (CR) line-breaks, and after application of the "Filter Clipboard with Unix Line Endings" action to the clipboard, the paste, the Ctrl M appear to be replaced by space rather than LF:

Looking more closely, there is a translation, but I'm not sure that I quite understand what it is. A hexdump of the clipboard before and after the Filter Clipboard with Unix Line Endings action shows:

0d → e2 80 a8

Which looks as if it may be a 3 byte Line Separator sequence
rather than LF (0A)

In case it helps: sample PDF page from which 3 code lines are copied, with macro, and clipboard hexdump results before and after macro application: (78.2 KB)

There are two issues going on.

In this section of the PDF:

They are not returns at the end of lines but some sort of line break / paragraph break when read as rich text.

When read as plain text, they are returns.

And so then we hit the second issue, which is that rich text and plain text variants on the clipboard can be quite different (see the wiki page Removing Styles Changes The Text).

So if you use the sequence:

You will probably get what you expect.

Thank you ! That makes absolute sense and works perfectly.

The wiki is very helpful, too – I hadn't seen it.