Some small corrections
Added example expression (hardcoded for development) Added example change for expressions (hardcoded for development)
This commit is contained in:
@@ -8,6 +8,8 @@
|
||||
|
||||
#import "MPExpressionStorage.h"
|
||||
#import "MPExpressionLayout.h"
|
||||
#import "MPFunctionLayout.h"
|
||||
#import "MPRangePath.h"
|
||||
|
||||
@interface MPExpressionStorage ()
|
||||
@property (nonatomic, strong) NSLayoutManager *layoutManager;
|
||||
@@ -57,4 +59,24 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)symbolsChangedInRangePath:(MPRangePath *)rangePath replacementLength:(NSUInteger)length
|
||||
{
|
||||
if (rangePath.location.length == 0) {
|
||||
return;
|
||||
}
|
||||
id current = self.expressionLayout;
|
||||
for (NSUInteger position = 1; position < rangePath.location.length-1; position++) {
|
||||
if ([current isKindOfClass:[MPExpressionLayout class]]) {
|
||||
current = [(MPExpressionLayout *)current functionLayoutForFunctionAtIndex:position];
|
||||
} else {
|
||||
current = [(MPFunctionLayout *)current expressionLayoutForChildAtIndex:position];
|
||||
}
|
||||
}
|
||||
if ([current isKindOfClass:[MPExpressionLayout class]]) {
|
||||
[(MPExpressionLayout *)current editedExpressionInRange:rangePath.rangeAtLastIndex replacementLength:length];
|
||||
} else {
|
||||
[(MPFunctionLayout *)current editedChildAtIndex:[rangePath.location indexAtPosition:rangePath.location.length-1]];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user