From 07d509ae7866368ce1dc611b4531917b765b509f Mon Sep 17 00:00:00 2001 From: twanvl Date: Sat, 9 Aug 2008 14:41:38 +0000 Subject: [PATCH] Fixed: last cursor position of text box was not checked when trying to find new cursor position. git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1118 0fc631ac-6414-0410-93d0-97cfa31319b6 --- src/gui/value/text.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/value/text.cpp b/src/gui/value/text.cpp index 677f2c17..f878c8b7 100644 --- a/src/gui/value/text.cpp +++ b/src/gui/value/text.cpp @@ -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 size_t best_match = 0; 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) { 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))) {