Code Snippet - Ellipsing Paths at Popupmenu
Posted: 28 Jul 2014 11:23
Bothered with popping an unfriendly menu to your fellow mates, chap?
So here's a plugin code you may easily integrate into yours avoiding stress, relieving from boring time, increasing life span, making more money, working less, making friends, influencing people and having more time to spend with your...
...social network. ¬¬
Tech notes:
-$a contains the input paths;
- $pathLENmax = "35";
$pathLENmaxP2 = "35";
can be tweaked, controlling the length of right and left sides of $mid (which I usually put in the upper part, but this time is out of reach as it's unusual to see any other separator than "...");
-$pathLENmax+$pathLENmaxP2 are the limits for the path length - any pathname longer than this will be ellipsed, shorter will not;
-the last component, folder or file, will never be ellipsed for better user control over targets;
-labels can easily be substr'ed, if they turn into a problem for you with displaying longish targets.
Enhancements are welcome.
Here's an example. Bear in mind that the path is delivered by variable '$b', which works independently from the echo'ed stuff: A non-ellipsed menu looks like this (the problem becomes more evident the longer the actual paths are): ________
keywords: snippet ; plugin ; plug-in ; method
So here's a plugin code you may easily integrate into yours avoiding stress, relieving from boring time, increasing life span, making more money, working less, making friends, influencing people and having more time to spend with your...
...social network. ¬¬
Tech notes:
-$a contains the input paths;
- $pathLENmax = "35";
$pathLENmaxP2 = "35";
can be tweaked, controlling the length of right and left sides of $mid (which I usually put in the upper part, but this time is out of reach as it's unusual to see any other separator than "...");
-$pathLENmax+$pathLENmaxP2 are the limits for the path length - any pathname longer than this will be ellipsed, shorter will not;
-the last component, folder or file, will never be ellipsed for better user control over targets;
-labels can easily be substr'ed, if they turn into a problem for you with displaying longish targets.
Enhancements are welcome.
Here's an example. Bear in mind that the path is delivered by variable '$b', which works independently from the echo'ed stuff: A non-ellipsed menu looks like this (the problem becomes more evident the longer the actual paths are): ________
keywords: snippet ; plugin ; plug-in ; method