#3 Trim/compress whitespace for preview in the menu

closed
nobody
5
2009-03-22
2007-04-12
Anonymous
No

If I copy text that starts with a lot of whitespace (which is often the case for sourcecode) I won't see anything in the menulet - entries are full of blanks.

It would be nice if JumpCut trimmed whitespace and/or compressed all runs of whitespace into single spaces, so as much meaningful content would fit in the menu as possible.

Thanks!

Discussion

  • Logged In: NO

    Happy Birthday to Tracker Item [ 1699096 ]

    Thank you for releasing JunmpCut. It is a marvelous piece of work.

    I agree, but this might mean that clippings that differed only in prefatory white space would
    be indistinguishable from one another.

    Here is a patch that does this. It may be small enough to apply by eye.

    Of course you will also need the requisite category on NSString, which I have not attached
    here, partly because I have also written some unit tests and the patch is therefore a bit
    intrusive, and partly because there are various categories of this type floating around,
    named 'Crunch', 'Condense' or 'Trim', on CocoaDev, Karelia (Watson) and the ever useful
    Omnigroup.

    --- Sorry, Can't work out how to attach files ---
    Index: JumpcutClipping.m
    ===================================================================
    --- JumpcutClipping.m (revision 29)
    +++ JumpcutClipping.m (working copy)
    @@ -25,6 +25,7 @@
    //

    #import "JumpcutClipping.h"
    +#import "NSString+Fold.h"

    @implementation JumpcutClipping

    @@ -131,6 +132,7 @@
    [clipContents getLineStart:&start end:&lineEnd contentsEnd:&contentsEnd forRange:startRange];
    contentsRange = NSMakeRange(0, contentsEnd);
    firstLineOfClipping = [clipContents substringWithRange:contentsRange];
    + firstLineOfClipping = [firstLineOfClipping stringWithLeftFold];
    if ( [firstLineOfClipping length] > clipDisplayLength ) {
    newDisplayString = [[NSString stringWithString:[firstLineOfClipping substringToIndex:clipDisplayLength]] stringByAppendingString:@"..."];
    } else {

     
  • Steve C
    Steve C
    2009-03-22

    • status: open --> closed
     
  • Steve C
    Steve C
    2009-03-22

    This will be in the 0.64 release. If anonymous is monitoring this, send me your name and I'll give you credit for the suggestion/patch in the changelog.