Bug in RichTextCtrl when the vertical tool bar is disabled and the height is set to 28

Hi,

The program crashes when you type something in RichTextCtrl, if you disable the vertical scroll bar of RichTextCtrl and set the widget height to 28.

If you set the widget height to 30, however, it doesn’t crash.
Or, if you set the height to 28 and enable the vertical scroll bar, it doesn’t crash either.

I use Windows 10, python 3.11.4, wxpython 4.2.1.

What’s wrong here?

import wx
import wx.richtext as rt

class MyFrame(wx.Frame):

    def __init__(self, parent):

        wx.Frame.__init__(self, parent, -1, "RichText")

        self.panel = wx.Panel(self)
        widget_height = 28
        self.rt = rt.RichTextCtrl(self.panel, -1, size=(200, widget_height))
        self.rt.EnableVerticalScrollbar(False)


        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(self.rt, 0, wx.ALIGN_CENTER | wx.ALL, 20)

        self.panel.SetSizer(sizer)
        sizer.Layout()


app = wx.App(0)
frame = MyFrame(None)
app.SetTopWindow(frame)
frame.Show()
app.MainLoop()

I confirmed that whatever the height value is, it crashes when the input text row exceeds the control height. For example, if the height is 100, it will crash when it tries to display the 5th row.

This must be a bug in wxWidgets 3.2.2.1

Can you report this to the wxWidgets issue tracker?
No need to write C++ code. Python code is fine too.