[Scummvm-git-logs] scummvm master -> f11b5b33dc2a05555212d60fca587cb08fec3b86
sev-
sev at scummvm.org
Mon Jun 29 23:04:50 UTC 2020
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
f11b5b33dc GRAPHICS: MACGUI: Keep cursor position after paragraph reshuffling
Commit: f11b5b33dc2a05555212d60fca587cb08fec3b86
https://github.com/scummvm/scummvm/commit/f11b5b33dc2a05555212d60fca587cb08fec3b86
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-06-30T01:04:08+02:00
Commit Message:
GRAPHICS: MACGUI: Keep cursor position after paragraph reshuffling
Changed paths:
graphics/macgui/mactext.cpp
diff --git a/graphics/macgui/mactext.cpp b/graphics/macgui/mactext.cpp
index 4575f2b4a8..635e49d7a2 100644
--- a/graphics/macgui/mactext.cpp
+++ b/graphics/macgui/mactext.cpp
@@ -1556,6 +1556,14 @@ void MacText::reshuffleParagraph(int *row, int *col) {
while (end < (int)_textLines.size() - 1 && !_textLines[end].paragraphEnd) // stop at last line
end++;
+ // Get character pos within paragraph
+ int ppos = 0;
+
+ for (int i = start; i < *row; i++)
+ ppos += getLineCharWidth(i);
+
+ ppos += *col;
+
// Get whole paragraph
Common::U32String paragraph = getTextChunk(start, 0, end, -1, true, false);
@@ -1566,6 +1574,15 @@ void MacText::reshuffleParagraph(int *row, int *col) {
// And now readd it
splitString(paragraph, start);
+
+ // Find new pos within paragraph after reshuffling
+ *row = start;
+
+ while (ppos > getLineCharWidth(*row)) {
+ ppos -= getLineCharWidth(*row);
+ (*row)++;
+ }
+ *col = ppos;
}
//////////////////
More information about the Scummvm-git-logs
mailing list