fixes for highlighting the expression and calculating factorial

This commit is contained in:
serso
2011-10-30 00:36:07 +04:00
parent 6e245d2dba
commit 4de9a780e9
4 changed files with 16 additions and 5 deletions

View File

@@ -84,7 +84,9 @@ public class CalculatorEditor extends EditText {
}
Log.d(this.getClass().getName(), getText().toString());
setSelection(selectionStart, selectionEnd);
int length = getText().length();
setSelection(Math.max(Math.min(length - 1, selectionStart), 0), Math.max(Math.min(length - 1, selectionEnd), 0));
}
public boolean isHighlightText() {

View File

@@ -45,10 +45,6 @@ class ToJsclTextProcessor implements TextProcessor<PreparedExpression> {
if (mathTypeBefore == MathType.function && CollectionsUtils.find(MathType.openGroupSymbols, startsWithFinder) != null) {
throw new ParseException("Empty function: " + mathTypeResult.getMatch());
} else if (mathTypeBefore == MathType.postfix_function && mathTypeResult.getMathType() == MathType.binary_operation) {
if ( mathTypeResult.getMatch().equals("^") ) {
throw new ParseException("Power operation after postfix function is currently unsupported!");
}
}
i = mathTypeResult.processToJscl(result, i);