ColinPitrat / caprice32

An emulator of the Amstrad CPC 8bit home computer range.
GNU General Public License v2.0
147 stars 32 forks source link

UI exception on selected text in textbox #229

Open ColinPitrat opened 2 years ago

ColinPitrat commented 2 years ago

When selecting text across lines in multiline text in a textbox and unselecting from the right, an exception is raised when reaching the beginning of the line.

At the time of writing, this happens in:

#4  0x0000555555660e82 in wGui::CTextBox::Draw (this=0x55555613bc00) at src/gui/src/wg_textbox.cpp:242          
242                                                     SelRect.SetRight(vCharRects.at(CurLine).at(SelEndPoint.XPos() - 1).Right() +    

This code is wrong because it should handle selection at the char level. On the other hand, it's probably necessary to keep coordinates of selection for movements up and down.

ColinPitrat commented 2 years ago

Note: this is not a big deal because unless I'm mistaken, we don't use an editable textbox anywhere in Caprice.