Commit 56dcf766 authored by twanvl's avatar twanvl

Fixed: last cursor position of text box was not checked when trying to find new cursor position.

parent c54ef386
...@@ -944,7 +944,7 @@ void TextValueEditor::replaceSelection(const String& replacement, const String& ...@@ -944,7 +944,7 @@ void TextValueEditor::replaceSelection(const String& replacement, const String&
// try to find the best match to what text we expected to be around the cursor // try to find the best match to what text we expected to be around the cursor
size_t best_match = 0; size_t best_match = 0;
size_t begin = min(start, expected_cursor); size_t begin = min(start, expected_cursor);
size_t end = min(real_value.size(), max(real_value.size() - end_min, expected_cursor) + 1); size_t end = min(real_value.size() + 1, max(real_value.size() - end_min, expected_cursor) + 1);
for (size_t i = begin ; i < end ; ++i) { for (size_t i = begin ; i < end ; ++i) {
size_t match = match_cursor_position(expected_cursor, expected_value, i, real_value); size_t match = match_cursor_position(expected_cursor, expected_value, i, real_value);
if (match > best_match || (match == best_match && abs((int)expected_cursor - (int)i) < abs((int)expected_cursor - (int)best_cursor))) { if (match > best_match || (match == best_match && abs((int)expected_cursor - (int)i) < abs((int)expected_cursor - (int)best_cursor))) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment