summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-07-01 12:30:48 +0300
committerAndrei Karas <akaras@inbox.ru>2013-07-01 12:30:48 +0300
commit222d6c7b11263bea997a127ca24b491370e090d6 (patch)
tree28bb9b5db426eeee2bf7cd051ae06328e74396d6 /src/gui
parent356ac7c52ae8cebc5df4d08e1e2cf30cfd66d869 (diff)
downloadmanaplus-222d6c7b11263bea997a127ca24b491370e090d6.tar.gz
manaplus-222d6c7b11263bea997a127ca24b491370e090d6.tar.bz2
manaplus-222d6c7b11263bea997a127ca24b491370e090d6.tar.xz
manaplus-222d6c7b11263bea997a127ca24b491370e090d6.zip
improve size() usage in textfield.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/widgets/textfield.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp
index 006fb4503..b4aace3cf 100644
--- a/src/gui/widgets/textfield.cpp
+++ b/src/gui/widgets/textfield.cpp
@@ -519,8 +519,9 @@ void TextField::fixScroll()
void TextField::setCaretPosition(unsigned int position)
{
- if (position > mText.size())
- mCaretPosition = static_cast<int>(mText.size());
+ const unsigned int sz = mText.size();
+ if (position > sz)
+ mCaretPosition = static_cast<int>(sz);
else
mCaretPosition = position;