[Scummvm-git-logs] scummvm master -> 9768c16e468b71d66ef05cfa18a0e70ea7065666
sev-
noreply at scummvm.org
Sat Jan 3 20:55:10 UTC 2026
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
352aa5c110 GRAPHICS: MACGUI: Fix editable text scrolling in MacTextWindow
9768c16e46 GRAPHICS : MACGUI : Add input padding behavior to prevent coverage of last line
Commit: 352aa5c110fe7c606a57b3d5ee52a895ed81782e
https://github.com/scummvm/scummvm/commit/352aa5c110fe7c606a57b3d5ee52a895ed81782e
Author: Al-Hassan ibrahim (alhassanibrahim.dev01 at gmail.com)
Date: 2026-01-03T23:55:05+03:00
Commit Message:
GRAPHICS: MACGUI: Fix editable text scrolling in MacTextWindow
Fix incorrect scroll position calculation when editing text inside
MacTextWindow, ensuring bottom padding is applied based on the last line
height to prevent the cursor from being partially hidden.
Changed paths:
graphics/macgui/mactextwindow.cpp
diff --git a/graphics/macgui/mactextwindow.cpp b/graphics/macgui/mactextwindow.cpp
index 975b4fe40a2..4bbc17c9032 100644
--- a/graphics/macgui/mactextwindow.cpp
+++ b/graphics/macgui/mactextwindow.cpp
@@ -123,7 +123,19 @@ void MacTextWindow::appendText(const Common::U32String &str, const MacFont *macF
_inputIsDirty = true; //force it to redraw input
if (_editable) {
- _mactext->_scrollPos = MAX<int>(0, _mactext->getTextHeight() - getInnerDimensions().height());
+ // Add one line of bottom padding to ensure the last line is not covered
+ int padding = _mactext->getLineHeight(_mactext->getLineCount() - 1);
+ padding = MIN<int>(padding, getInnerDimensions().height());
+
+ int oldScroll = _mactext->_scrollPos;
+
+ _mactext->_scrollPos = MAX<int>(0, _mactext->getTextHeight() - getInnerDimensions().height() + padding);
+
+ if (_mactext->_scrollPos != oldScroll) {
+ _mactext->undrawCursor();
+ _mactext->_cursorY -= (_mactext->_scrollPos - oldScroll);
+ _mactext->_cursorDirty = true;
+ }
}
if (_wm->_mode & kWMModeWin95)
Commit: 9768c16e468b71d66ef05cfa18a0e70ea7065666
https://github.com/scummvm/scummvm/commit/9768c16e468b71d66ef05cfa18a0e70ea7065666
Author: Al-Hassan ibrahim (alhassanibrahim.dev01 at gmail.com)
Date: 2026-01-03T23:55:05+03:00
Commit Message:
GRAPHICS : MACGUI : Add input padding behavior to prevent coverage of last line
- Updated `MacText::appendText_` to optionally add a newline at the end of input text, ensuring consistent padding behavior across different contexts.
- Adjusted cursor positioning to ensure it is placed on the last content line, not on the padding line, when `_addInputPadding` is enabled.
- Introduced `setInputPadding(bool enable)` in `MacText` to dynamically control the addition of padding, allowing flexibility for different parts of ScummVM that use `MacText`.
This change resolves issues with the last line of input text being covered by padding, and improves text layout consistency across different use cases.
Changed paths:
graphics/macgui/mactext.cpp
graphics/macgui/mactext.h
graphics/macgui/mactextwindow.cpp
diff --git a/graphics/macgui/mactext.cpp b/graphics/macgui/mactext.cpp
index 1c41a6ac4c4..a1ca34ffb87 100644
--- a/graphics/macgui/mactext.cpp
+++ b/graphics/macgui/mactext.cpp
@@ -237,6 +237,8 @@ void MacText::init(uint32 fgcolor, uint32 bgcolor, int maxWidth, TextAlign textA
_editable = false;
_selectable = false;
+ _addInputPadding = false;
+
_editableRow = 0;
_autoSelect = true;
@@ -826,7 +828,12 @@ void MacText::appendText(const Common::U32String &str, const Font *font, uint16
void MacText::appendText_(const Common::U32String &strWithFont, uint oldLen) {
clearChunkInput();
- _canvas.splitString(strWithFont, -1, _defaultFormatting);
+ Common::U32String finalText = strWithFont;
+
+ if (_addInputPadding && _editable && strWithFont.lastChar() != '\n')
+ finalText += '\n';
+
+ _canvas.splitString(finalText, -1, _defaultFormatting);
recalcDims();
_canvas.render(oldLen - 1, _canvas._text.size());
@@ -836,7 +843,8 @@ void MacText::appendText_(const Common::U32String &strWithFont, uint oldLen) {
if (_editable) {
_scrollPos = MAX<int>(0, getTextHeight() - getDimensions().height());
- _cursorRow = MAX<int>(getLineCount() - 1, 0);
+ short paddingLines = _addInputPadding ? 1 : 0;
+ _cursorRow = MAX<int>(getLineCount() - 1 - paddingLines, 0);
_cursorCol = _canvas.getLineCharWidth(_cursorRow);
updateCursorPos();
diff --git a/graphics/macgui/mactext.h b/graphics/macgui/mactext.h
index a12a5697c20..cc4e97be07f 100644
--- a/graphics/macgui/mactext.h
+++ b/graphics/macgui/mactext.h
@@ -87,6 +87,7 @@ public:
virtual Common::Point calculateOffset();
void setActive(bool active) override;
void setEditable(bool editable);
+ void setInputPadding(bool enable){ _addInputPadding = enable; }
void setColors(uint32 fg, uint32 bg) override;
// set fgcolor for line x
@@ -246,6 +247,8 @@ private:
int _editableRow;
+ bool _addInputPadding;
+
bool _inTextSelection;
SelectedText _selectedText;
bool _selectionIsDirty;
diff --git a/graphics/macgui/mactextwindow.cpp b/graphics/macgui/mactextwindow.cpp
index 4bbc17c9032..815d0d9677c 100644
--- a/graphics/macgui/mactextwindow.cpp
+++ b/graphics/macgui/mactextwindow.cpp
@@ -69,7 +69,7 @@ void MacTextWindow::init() {
_selectable = true;
_textColorRGB = 0;
-
+
// Disable autoselect on activation
_mactext->setAutoSelect(false);
@@ -113,6 +113,9 @@ void MacTextWindow::appendText(const Common::U32String &str, const MacFont *macF
uint16 green = (_textColorRGB >> 8) & 0xFF;
uint16 blue = (_textColorRGB) & 0xFF;
+ // Adding empty line at the bottom of the input text area if needed
+ _mactext->setInputPadding(true);
+
if (macFont)
_mactext->appendText(str, macFont->getId(), macFont->getSize(), macFont->getSlant(), red, green, blue, skipAdd);
else {
More information about the Scummvm-git-logs
mailing list