From c6c4eef4e49bb4de90845408af9f642a1a4e224b Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 17 Aug 2012 16:34:36 +0300 Subject: Improve size calculations. --- src/gui/widgets/textbox.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/gui/widgets/textbox.cpp') 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(mTextRows.size())) + const int sz = static_cast(mTextRows.size()); + if (mCaretRow >= sz) { - mCaretRow = static_cast(mTextRows.size()) - 1; + mCaretRow = sz - 1; if (mCaretRow < 0) mCaretRow = 0; -- cgit v1.2.3-60-g2f50