diff --git a/MathPad/MPExpression.h b/MathPad/MPExpression.h index 977470e..6b8b1c8 100644 --- a/MathPad/MPExpression.h +++ b/MathPad/MPExpression.h @@ -22,8 +22,6 @@ extern NSString *MPDivisionOperator; #pragma mark Working With the Expression Tree @property (nonatomic, weak) MPFunction *parent; // Documentation: Do not set, may be nil -- (void)functionSymbolChanged:(MPFunction *)symbol - atLocalIndexPath:(NSIndexPath *)indexPath; // Index path of change in symbol - (void)fixSymbols; diff --git a/MathPad/MPExpression.m b/MathPad/MPExpression.m index 63f9fd6..409bddf 100644 --- a/MathPad/MPExpression.m +++ b/MathPad/MPExpression.m @@ -50,14 +50,6 @@ NSString *MPDivisionOperator = @"/"; #pragma mark Working With the Expression Tree -- (void)functionSymbolChanged:(MPFunction *)symbol atLocalIndexPath:(NSIndexPath *)indexPath -{ - NSUInteger index = [_symbols indexOfObject:symbol]; - if (index != NSNotFound) { - [self.parent childChanged:self atLocalIndexPath:[indexPath indexPathByAddingIndex:index]]; - } -} - - (void)fixSymbols { _symbols = [self fixedSymbols:_symbols]; @@ -445,8 +437,12 @@ NSString *MPDivisionOperator = @"/"; // Locate the position, split the symbols NSUInteger startIndex; - [self splitSymbolsAtLocation:range.location - insertionIndex:&startIndex]; + if ([self numberOfSymbols] == 0) { + startIndex = 0; + } else { + [self splitSymbolsAtLocation:range.location + insertionIndex:&startIndex]; + } // Perform the deletion if (range.length > 0) { diff --git a/MathPad/MPFunction.h b/MathPad/MPFunction.h index dc3b7b0..336ed3e 100644 --- a/MathPad/MPFunction.h +++ b/MathPad/MPFunction.h @@ -17,8 +17,6 @@ #pragma mark Working With the Expression Tree @property (nonatomic, weak) MPExpression *parent; // Documentation: Do not set -- (void)childChanged:(MPExpression *)child - atLocalIndexPath:(NSIndexPath *)indexPath; - (NSUInteger)numberOfChildren; - (MPExpression *)childAtIndex:(NSUInteger)index; diff --git a/MathPad/MPFunction.m b/MathPad/MPFunction.m index 6c6e2aa..d54e920 100644 --- a/MathPad/MPFunction.m +++ b/MathPad/MPFunction.m @@ -23,12 +23,6 @@ #pragma mark Working With the Expression Tree -- (void)childChanged:(MPExpression *)child atLocalIndexPath:(NSIndexPath *)indexPath -{ - [self.parent functionSymbolChanged:self - atLocalIndexPath:[indexPath indexPathByAddingIndex:0]]; -} - - (NSUInteger)numberOfChildren { return 0;