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
Code Snippet - Ellipsing Paths at Popupmenu
-
SkyFrontier
- Posts: 2341
- Joined: 04 Jan 2010 14:27
- Location: Pasárgada (eu vou!)
Code Snippet - Ellipsing Paths at Popupmenu
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...
-
PeterH
- Posts: 2826
- Joined: 21 Nov 2005 20:39
- Location: DE W11Pro 24H2, 1920*1200*100% 3840*2160*150%
Re: Code Snippet - Ellipsing Paths at Popupmenu
Just an idea: for deciding whether to ellipse a string or not you could add about 2 characters. As for your 3rd example an "a" is replaced by ellipses - so the resultant string is longer than the original.
By the way: could be a nice function.
Too bad XY doesn't allow user-written functions
(Sorry: I didn't mention this for quite a long time, so I did here
)
By the way: could be a nice function.
Too bad XY doesn't allow user-written functions
(Sorry: I didn't mention this for quite a long time, so I did here
-
SkyFrontier
- Posts: 2341
- Joined: 04 Jan 2010 14:27
- Location: Pasárgada (eu vou!)
Re: Code Snippet - Ellipsing Paths at Popupmenu
Hi, Peter.PeterH wrote:Just an idea: for deciding whether to ellipse a string or not you could add about 2 characters. As for your 3rd example an "a" is replaced by ellipses - so the resultant string is longer than the original.
By the way: could be a nice function.
Too bad XY doesn't allow user-written functions![]()
(Sorry: I didn't mention this for quite a long time, so I did here)
Missed your comment here back then, sorry.
Yes, I noticed this but didn't care enough to fix it. Will do, anytime soon (as time permits).
By the way, I updated the ellipsing code logic on another script.
Thanks for the feedback.
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...
-
PeterH
- Posts: 2826
- Joined: 21 Nov 2005 20:39
- Location: DE W11Pro 24H2, 1920*1200*100% 3840*2160*150%
Re: Code Snippet - Ellipsing Paths at Popupmenu
Hey: a feedback to myself: in between the time user functions are there
Very very fine
Very very fine
XYplorer Beta Club