Skip to content

Commit d69a199

Browse files
committed
Fixed caret position calculation in UITextInput
1 parent 47148ce commit d69a199

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

Modules/Contents/UI/Source/PolyUITextInput.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1106,8 +1106,14 @@ int UITextInput::caretSkipWordBack(int caretLine, int caretPosition) {
11061106
if(!isNumberOrCharacter(chr) && i < caretPosition-1) {
11071107
return i+1;
11081108
}
1109-
}
1110-
return 0;
1109+
}
1110+
String bit = lines[caretLine].text;
1111+
char chr = ((char*)bit.c_str())[0];
1112+
if(isNumberOrCharacter(chr)) {
1113+
return 0;
1114+
} else {
1115+
return 1;
1116+
}
11111117
}
11121118

11131119
int UITextInput::caretSkipWordForward(int caretLine, int caretPosition) {
@@ -1680,6 +1686,7 @@ void UITextInput::showLine(unsigned int lineNumber, bool top) {
16801686

16811687
bool UITextInput::isNumberOrCharacter(wchar_t charCode) {
16821688

1689+
if(charCode == '\t' || charCode == ' ') return false;
16831690
if(charCode == '_') return true;
16841691

16851692
if(charCode > 47 && charCode < 58)

0 commit comments

Comments
 (0)