diff --git a/src/univ/textctrl.cpp b/src/univ/textctrl.cpp index d8816f8974..00e987b800 100644 --- a/src/univ/textctrl.cpp +++ b/src/univ/textctrl.cpp @@ -3615,8 +3615,12 @@ void wxTextCtrl::UpdateScrollbars() if ( scrollRangeXOld ) { - x *= scrollRangeX - m_rectText.width / charWidth; - x /= scrollRangeXOld - m_rectText.width / charWidth; + const int w = m_rectText.width / charWidth; + if ( w != scrollRangeXOld ) + { + x *= scrollRangeX - w; + x /= scrollRangeXOld - w; + } Scroll(x, y); }