|
|
1.1 ! root 1: #import "textundo.h" ! 2: ! 3: @implementation WholeTextChange ! 4: ! 5: /* ! 6: * This is another variant of a TextSelChange which always records the entire ! 7: * contents of the text object. This is useful when a particular kind of ! 8: * change isn't restricted to the current selection. Examples include ruler ! 9: * changes for tabs and margins, and characters entered from the keyboard. ! 10: */ ! 11: ! 12: - saveBeforeChange ! 13: { ! 14: NXSelPt start, end; ! 15: ! 16: [textView getSel:&start :&end]; ! 17: ! 18: oldSel = [[[CutSelection alloc] initText:textView ! 19: start:0 ! 20: end:[textView textLength]] capture]; ! 21: [oldSel setVisible:start.cp :end.cp]; ! 22: return self; ! 23: } ! 24: ! 25: - saveAfterChange ! 26: { ! 27: NXSelPt start, end; ! 28: ! 29: [textView getSel:&start :&end]; ! 30: ! 31: newSel = [[[CutSelection alloc] initText:textView ! 32: start:0 ! 33: end:[textView textLength]] capture]; ! 34: [newSel setVisible:start.cp :end.cp]; ! 35: return self; ! 36: } ! 37: ! 38: - setStart:(int)start end:(int)end ! 39: { ! 40: [newSel setVisible:start :end]; ! 41: return self; ! 42: } ! 43: ! 44: @end
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.