-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Update mactext-canvas.cpp #6506
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Added some checks to make sure The line continuations are not empty before adding them to the current line's word continuation to ensure consistency. Also added some comments on previous code. Made sure to append the chunks if it is within bounds. Added the newChunk as a pointer to the current chunk.
You must follow our Commit Guidelines: https://wiki.scummvm.org/index.php?title=Commit_Guidelines And while your code formatting is fine, could you please remove those excessive empty lines around practically every code change? Just follow the code formatting in the rest of the file and do not introduce your own style. |
Ok i will keep that in mind and make sure to remove unnecessary empty lines |
for (int i = 0; i < (int)text.size(); i++) { | ||
|
||
D(9, "Line Continuations [%d] : %d", i, lineContinuations[i]); | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for (int i = 0; i < (int)text.size(); i++) { | |
D(9, "Line Continuations [%d] : %d", i, lineContinuations[i]); | |
} | |
for (int i = 0; i < (int)text.size(); i++) { | |
D(9, "Line Continuations [%d] : %d", i, lineContinuations[i]); | |
} |
for (int i = 0; i < (int)text.size(); i++) { | ||
|
||
D(9, "** chopChunk result %d \"%s\"", i, toPrintable(text[i].encode()).c_str()); | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for (int i = 0; i < (int)text.size(); i++) { | |
D(9, "** chopChunk result %d \"%s\"", i, toPrintable(text[i].encode()).c_str()); | |
} | |
for (int i = 0; i < (int)text.size(); i++) { | |
D(9, "** chopChunk result %d \"%s\"", i, toPrintable(text[i].encode()).c_str()); | |
} |
//Ensure line continuations is valid before accesing index 0 | ||
if (!lineContinuations.empty()) { | ||
|
||
_text[curLine].wordContinuation = lineContinuations[0]; | ||
|
||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
//Ensure line continuations is valid before accesing index 0 | |
if (!lineContinuations.empty()) { | |
_text[curLine].wordContinuation = lineContinuations[0]; | |
} | |
// Ensure line continuations is valid before accessing index 0 | |
if (!lineContinuations.empty()) { | |
_text[curLine].wordContinuation = lineContinuations[0]; | |
} | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
accessing*
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
accessing*
Indeed! Updated the change above accordingly :)
MacFontRun newchunk = *chunk; | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MacFontRun newchunk = *chunk; | |
MacFontRun newchunk = *chunk; |
chunk->text += str; | ||
|
||
if (w < maxWidth) { | ||
chunk->text += str; //Only append if within bounds |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
chunk->text += str; //Only append if within bounds | |
chunk->text += str; // Only append if within bounds |
… restoration issue in getmaxwidth. - Check for null pointer before handling any operations in getChunkNum function. - Check for empty chunks to avoid extra operations. - avoid signed/unsigned issue in chunk position. - avoid possible overflow in cursor restoration logic
And why this PR was closed? |
Hey I just closed the PR by mistake and reopened another one , can you checked that one out . I misclicked to close this one out. |
We are generally annoyed by closed reports. It generates too much noise for the whole team. |
I am sorry I didn’t know that |
ENGINE: Ensure line continuations are valid before appending
appending them to the current line’s word continuation.
newChunk
as a pointer to the current chunk to maintainconsistency.