X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1fc5dc69fdb71cb98af8a76eeea44945e0b46730..cc24bf919256e8e1d317dbb8e67df6d007d641ea:/src/univ/textctrl.cpp 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); }