summaryrefslogtreecommitdiffstats
path: root/graphics
diff options
context:
space:
mode:
authorSeigo Nonaka <nona@google.com>2015-04-01 22:35:25 +0900
committerSeigo Nonaka <nona@google.com>2015-04-02 06:13:37 +0900
commitb89a605b58bc20ef1ee0923f0578a2fa99a71793 (patch)
treea946cdf3176a62bedf270a63be47b2c509de8422 /graphics
parentc09ccc5631d61f94200df2bb37262364bb598211 (diff)
downloadframeworks_base-b89a605b58bc20ef1ee0923f0578a2fa99a71793.zip
frameworks_base-b89a605b58bc20ef1ee0923f0578a2fa99a71793.tar.gz
frameworks_base-b89a605b58bc20ef1ee0923f0578a2fa99a71793.tar.bz2
Fix cursor position calculation.
The cursor position calculation of not well known CharSequence implementation has problem. getTextRunCursor() returns the relative path of passed string buffer, so need to fix the origin by adding the copied buffer origin. BUG: 17448027 Change-Id: I413c553bfccbccee4a390b6c83aa09ac7fd04126
Diffstat (limited to 'graphics')
-rw-r--r--graphics/java/android/graphics/Paint.java4
1 files changed, 2 insertions, 2 deletions
diff --git a/graphics/java/android/graphics/Paint.java b/graphics/java/android/graphics/Paint.java
index 1da198c..d3cb9b1 100644
--- a/graphics/java/android/graphics/Paint.java
+++ b/graphics/java/android/graphics/Paint.java
@@ -2120,9 +2120,9 @@ public class Paint {
int contextLen = contextEnd - contextStart;
char[] buf = TemporaryBuffer.obtain(contextLen);
TextUtils.getChars(text, contextStart, contextEnd, buf, 0);
- int result = getTextRunCursor(buf, 0, contextLen, dir, offset - contextStart, cursorOpt);
+ int relPos = getTextRunCursor(buf, 0, contextLen, dir, offset - contextStart, cursorOpt);
TemporaryBuffer.recycle(buf);
- return result;
+ return (relPos == -1) ? -1 : relPos + contextStart;
}
/**