Updated extension: Sort

The Sort extension is now updated for compatibility macOS Monterey.

Sort-demo

Full Readme:

Sort

Sorts lines using a natural, case-insensitive sort. Empty lines are removed from the output.

Condition to appear: Input contains more than one line.

Requirements

Requires PopClip 2021.11 (3785).

Notes

The original PHP version used the natcasesort function, which is a case-insensitive natural ordering. (A natural ordering treats numbers as numeric values rather than character values, and so is more “human-like”.)

In porting to JavaScript I have used localeCompare with options {numeric: true, sensitivity: 'base'}.

Authors

Agassi, Nick Moore

Changelog

v3 - 1 Nov 2021

  • Re-implemented in JavaScript.

v2 - 17 Dec 2015

  • Modified to no longer remove duplicates.

v1 - 8 Feb 2013

  • Original extension (PHP) by Agassi.
3 Likes

New to this great app. Just upgraded to Monterey but ‘sort’ doesn’t work for me. Can you help?
I have PopClip 2021.11

1 Like

Hi @Steveb - can you tell me a bit more about what is going wrong? What exactly happens when you try to use it?

Hello Nick, Thank you for your reply. I run Monterey on a Macbook pro and downloaded the latest version of pop clip. All good so far. I downloaded the ‘sort’ extension which I will find useful and it loads into the Popclip window but doesn’t show up when I highlight some text. The gearwheel to the right in the Popclip window is not there, as well as the line count and the word count. Hope you can help, Steve

And you are selecting multiple lines of text? It only appears if you select more than one line. Perhaps if you could record a short screen recording with. QuickTime Player, or similar, and send it to me (either post here or sent to my email) it would help me see what’s happening.

I opened 6 lines of text in MS Word just as a test. The ‘sort’ icon now appears but doesn’t sort the text. Screenshot attached. The icon doesn’t appear at all in Affinity Publisher.

1 Like

According to PopClip you selected only 2 lines in your capture. Maybe that’s the problem?

A paragraph of text in Word will only be 1 line from the point of view of PopClip since the text is soft wrapped, it appears as one continuous line to PopClip.

It looks like PopClip is seeing 2 lines in your example, as probably there is a blank line selected at the end. So “Sort” is appearing, but it has no real effect since applying it to a paragraph won’t change it.

Try entering a number of lines with line breaks at the ends. The crucial point is that a line is defined by pressing the enter key at the end of the line.

CleanShot 2022-02-11 at 07.21.49

1 Like