MalisisCore

48M Downloads

UITextField offset isn't adjusted to match cursor position after resizing

Barteks2x opened this issue ยท 8 comments

commented

I used UITextField.getCursorPosition().jumpToEnd() to jumpt to the end of the text, but it doesn't work correctly after resizing the UITextField.

What it should look like (click to expand):

2017-07-26_00 02 02

After decreasing size:

2017-07-26_00 02 08

After increasing size:

2017-07-26_00 02 12

commented

I'm not sure what you mean with the jumpToEnd().
But if you mean that the charOffset doesn't automatically go back so that the full width is used instead of leaving some blank, I don't really see that as an issue. And I'm not sure it's worth fixing.

commented

See the screenshot when decreasing size.. It cuts off the end of the string instead of still showing the end.

commented

Well yes, when you resize, the offset stays the same. Like I said, not really an issue.

commented

I guess not many people are going to actually resize the window there. I still consider it an issue but if it works as it should work...

commented

The question is, when you decrease the size, why should the end offset be constant instead of the start offset ? Is it because the end offset happens to match string length ?

commented

Because that's where I set the cursor position and after resize the cursor position is no longer in the visible area.

commented

That's because when you resize, you loose the focus of the textfield and there is no cursor anymore.

commented

I set the cursor position to the end of the string right after setting the string to match vanilla behavior in this case. Setting it seems to work even when that component is not in focus. So it still has a cursor position even if the cursor is not shown.