diff options
author | Hans Boehm <hboehm@google.com> | 2015-06-23 18:32:02 -0700 |
---|---|---|
committer | Hans Boehm <hboehm@google.com> | 2015-06-24 05:10:40 +0000 |
commit | 15a853dd8410b2b690c3907860b6631c2d814928 (patch) | |
tree | 31c90402e28f9fe1c4f4c10235048cc60006a466 /src | |
parent | 6e8087f483c13288bd589389414d9ed35ab73c31 (diff) | |
download | android_packages_apps_ExactCalculator-15a853dd8410b2b690c3907860b6631c2d814928.tar.gz android_packages_apps_ExactCalculator-15a853dd8410b2b690c3907860b6631c2d814928.tar.bz2 android_packages_apps_ExactCalculator-15a853dd8410b2b690c3907860b6631c2d814928.zip |
Restore original scroll position on =
Bug: 22041219
Restore default scrolling position when hitting enter after scrolling
an instant display result.
We could instead preserve the position and fix the display logic to
no longer get confused by a non-default initial position. But this
feels more natural to me.
Change-Id: I43bb936b5bb1b5af7a7befb90fdfc0f745fb7729
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/calculator2/Evaluator.java | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/com/android/calculator2/Evaluator.java b/src/com/android/calculator2/Evaluator.java index 666790a..081f843 100644 --- a/src/com/android/calculator2/Evaluator.java +++ b/src/com/android/calculator2/Evaluator.java @@ -818,8 +818,11 @@ class Evaluator { // Notify immediately, reusing existing result. int dotPos = mCache.indexOf('.'); String truncatedWholePart = mCache.substring(0, dotPos); - int leastDigPos = getLsd(mRatVal, mCache, dotPos); - mCalculator.onEvaluate(mLastDigs, getMsd(), leastDigPos, truncatedWholePart); + int leastDigOffset = getLsd(mRatVal, mCache, dotPos); + int msdIndex = getMsd(); + int preferredPrecOffset = getPreferredPrec(mCache, msdIndex, leastDigOffset); + mCalculator.onEvaluate(preferredPrecOffset, msdIndex, leastDigOffset, + truncatedWholePart); } } |