From 44e9218e0329d4295cf1b63d2c407b26164deff1 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 2 Feb 2023 17:09:06 +0100 Subject: [PATCH] Don't always increase height in DoGetSizeFromTextSize() The intention here almost certainly was to use at least the specified height, not to always add something to it at the end for no apparent reason, so do this instead. --- src/gtk/textctrl.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/gtk/textctrl.cpp b/src/gtk/textctrl.cpp index 371e789a96..db21759851 100644 --- a/src/gtk/textctrl.cpp +++ b/src/gtk/textctrl.cpp @@ -2180,10 +2180,9 @@ wxSize wxTextCtrl::DoGetSizeFromTextSize(int xlen, int ylen) const } } - // Perhaps the user wants something different from CharHeight, or ylen - // is used as the height of a multiline text. - if ( ylen > 0 ) - tsize.IncBy(0, ylen - cHeight); + // We should always use at least the specified height if it's valid. + if ( ylen > tsize.y ) + tsize.y = ylen; return tsize; }