PatateDev / sfml-ui

A simple UI library for SFML
GNU Lesser General Public License v3.0
11 stars 1 forks source link

Segmentation fault text field #13

Closed mathdu07 closed 10 years ago

mathdu07 commented 10 years ago

After setting a new text field's text shorter than the previous, the cursor stay in the same position. As a consequence, the cursor is out of the text's bound, and when a char is inserted/deleted, the text field tries to insert/delete a char out of the string, which cause a segmentation fault.

To fix it, it's needed to check if the cursor isn't out the string when setText(sf::String) is called, and if it's, then move the cursor to the new last char.