mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-23 11:04:44 +00:00
GRAPHICS: MACGUI: keep formatting in empty text
When text is emptied by user action, e.g. backspace, the formattting should be preserved. In the game Majestic a text box for user input would start out with the correct formatting, i.e. green text on a black background. When the user would then press backspace till the text was gone, the method `MacText::getTextChunk` would return an empty string, with the formatting removed. If the user started typing again the text would use the default formatting with black text on black background. Fixes: https://trello.com/c/POQZRCEO/546-text-doesnt-show-in-majestic-in-text-box
This commit is contained in:
parent
d33005f8b2
commit
157b1d9a48
@ -2170,8 +2170,12 @@ Common::U32String MacText::getTextChunk(int startRow, int startCol, int endRow,
|
||||
// We requested only part of one line
|
||||
if (i == startRow && i == endRow) {
|
||||
for (uint chunk = 0; chunk < _textLines[i].chunks.size(); chunk++) {
|
||||
if (_textLines[i].chunks[chunk].text.empty()) // skip empty chunks
|
||||
if (_textLines[i].chunks[chunk].text.empty()) {
|
||||
// skip empty chunks, but keep them formatted,
|
||||
// a text input box needs to keep the formatting even when all text is removed.
|
||||
ADDFORMATTING();
|
||||
continue;
|
||||
}
|
||||
|
||||
if (startCol <= 0) {
|
||||
ADDFORMATTING();
|
||||
|
Loading…
x
Reference in New Issue
Block a user