Bug 589844 - Return correct string from getTextBeforeCursor on Android; r=mwu a=blocking-fennec=2.0a1+

--HG--
branch : GECKO20b5pre_20100820_RELBRANCH
This commit is contained in:
Jim Chen 2010-08-23 10:54:00 -04:00
Родитель f8b1ab8dce
Коммит 110d1dd258
1 изменённых файлов: 11 добавлений и 4 удалений

Просмотреть файл

@ -234,10 +234,17 @@ public class GeckoInputConnection
/* Compatible with both positive and negative length
(no need for separate code for getTextBeforeCursor) */
int textStart = length > 0 ? mSelectionStart :
mSelectionStart + length > 0 ? mSelectionStart + length : 0;
int textLength = length > 0 ? length:
textStart == 0 ? mSelectionStart : length;
int textStart = mSelectionStart;
int textLength = length;
if (length < 0) {
textStart += length;
textLength = -length;
if (textStart < 0) {
textStart = 0;
textLength = mSelectionStart;
}
}
GeckoAppShell.sendEventToGecko(
new GeckoEvent(GeckoEvent.IME_GET_TEXT, textStart, textLength));