summaryrefslogtreecommitdiff
path: root/src/gui/widgets/textbox.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/widgets/textbox.cpp')
-rw-r--r--src/gui/widgets/textbox.cpp5
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;