Is performFindPanelAction: working properly?

  • Hi,

    I am currently using the find technology available in NSTextView.
    I have my own custom text storage. With Leopard, I can find and
    replace one by one but as soon as I try to replace many occurrences at
    a time, thing get broken.

    When replacing one occurrence at a time, some private NSTextFinder
    sends my custom text storage a replaceCharactersInRange:withString:
    message, everything is ok.

    When replacing many occurrences at once, it appears that the changes
    directly apply to the mutableString of my custom text storage,
    but the standard text storage method never get called. In particular
    my custom -edited:range:changeInLength: gets called when replacing one
    occurrence but not when replacing all occurrences. So my custom text
    storage never gets a chance to track any kind of change. Finally, it
    falls into an inconsistent state and dies.

    Investigating further might show that NSTextStorage private method

    - (void)replaceString:(NSString *)old withString:(NSString *)new
    ranges:(NSArray *)ranges options:(unsigned)options inView:(id)view
    replacementRange:(NSRange)range;

    does not take into account custom text storage.

    I ended reimplementing the method above, but it is reall a pain.
previous month november 2007 next month
MTWTFSS
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30    
Go to today