diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-08-17 16:34:36 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-08-17 16:34:36 +0300 |
commit | c6c4eef4e49bb4de90845408af9f642a1a4e224b (patch) | |
tree | 81d192e85b3c075cb2e52671bea4c3c0499dc3f2 /src/gui/widgets/textbox.cpp | |
parent | 093e392dd84c920d26bca17d48ac6611393d087c (diff) | |
download | manaverse-c6c4eef4e49bb4de90845408af9f642a1a4e224b.tar.gz manaverse-c6c4eef4e49bb4de90845408af9f642a1a4e224b.tar.bz2 manaverse-c6c4eef4e49bb4de90845408af9f642a1a4e224b.tar.xz manaverse-c6c4eef4e49bb4de90845408af9f642a1a4e224b.zip |
Improve size calculations.
Diffstat (limited to 'src/gui/widgets/textbox.cpp')
-rw-r--r-- | src/gui/widgets/textbox.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/gui/widgets/textbox.cpp b/src/gui/widgets/textbox.cpp index cd5b4bf99..048051bb9 100644 --- a/src/gui/widgets/textbox.cpp +++ b/src/gui/widgets/textbox.cpp @@ -191,9 +191,10 @@ void TextBox::keyPressed(gcn::KeyEvent& keyEvent) { ++ mCaretRow; - if (mCaretRow >= static_cast<int>(mTextRows.size())) + const int sz = static_cast<int>(mTextRows.size()); + if (mCaretRow >= sz) { - mCaretRow = static_cast<int>(mTextRows.size()) - 1; + mCaretRow = sz - 1; if (mCaretRow < 0) mCaretRow = 0; |