This is WholeTextChange.m in view mode; [Download] [Up]
#import "textundo.h"
@implementation WholeTextChange
/*
* This is another variant of a TextSelChange which always records the entire
* contents of the text object. This is useful when a particular kind of
* change isn't restricted to the current selection. Examples include ruler
* changes for tabs and margins, and characters entered from the keyboard.
*/
- saveBeforeChange
{
NXSelPt start, end;
[textView getSel:&start :&end];
oldSel = [[[CutSelection alloc] initText:textView
start:0
end:[textView textLength]] capture];
[oldSel setVisible:start.cp :end.cp];
return self;
}
- saveAfterChange
{
NXSelPt start, end;
[textView getSel:&start :&end];
newSel = [[[CutSelection alloc] initText:textView
start:0
end:[textView textLength]] capture];
[newSel setVisible:start.cp :end.cp];
return self;
}
- setStart:(int)start end:(int)end
{
[newSel setVisible:start :end];
return self;
}
@end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.