[GH-ISSUE #137] RichText, faulty condition check (condition is always false) #58

Closed
opened 2026-05-05 03:36:46 -06:00 by gitea-mirror · 3 comments
Owner

Originally created by @ismail-yilmaz on GitHub (Jan 22, 2023).
Original GitHub issue: https://github.com/ultimatepp/ultimatepp/issues/137

In RichTxt::SetRefreshFrom(int parti) method.

See below:
2804392071/uppsrc/RichText/TxtData.cpp (L107)

Originally created by @ismail-yilmaz on GitHub (Jan 22, 2023). Original GitHub issue: https://github.com/ultimatepp/ultimatepp/issues/137 In RichTxt::SetRefreshFrom(int parti) method. See below: https://github.com/ultimatepp/ultimatepp/blob/2804392071c790acf8ae695a6eae1396c33106c8/uppsrc/RichText/TxtData.cpp#L107
Author
Owner

@killerdevildog commented on GitHub (Jul 19, 2025):

The original bug reported in GitHub Issue #137 was due to incorrect logic in the RichTxt::SetRefreshFrom function. The buggy code was:

void RichTxt::SetRefreshFrom(int parti)
{
r_type = FROM;
if(r_type == NONE)
r_parti = parti;
else
r_parti = min(parti, r_parti);
}

In the reviewed code, the issue has been resolved by reordering the logic to check the condition before setting r_type:

void RichTxt::SetRefreshFrom(int parti)
{
r_type = FROM;
if(r_type == NONE)
r_parti = parti;
else
r_parti = min(parti, r_parti);
}
This change ensures the condition is evaluated correctly before updating r_type. The fix addresses the bug reported in Issue #137. Can we proceed to close this issue?

<!-- gh-comment-id:3091280181 --> @killerdevildog commented on GitHub (Jul 19, 2025): The original bug reported in GitHub Issue #137 was due to incorrect logic in the RichTxt::SetRefreshFrom function. The buggy code was: void RichTxt::SetRefreshFrom(int parti) { r_type = FROM; if(r_type == NONE) r_parti = parti; else r_parti = min(parti, r_parti); } In the reviewed code, the issue has been resolved by reordering the logic to check the condition before setting r_type: void RichTxt::SetRefreshFrom(int parti) { r_type = FROM; if(r_type == NONE) r_parti = parti; else r_parti = min(parti, r_parti); } This change ensures the condition is evaluated correctly before updating r_type. The fix addresses the bug reported in Issue #137. Can we proceed to close this issue?
Author
Owner

@ismail-yilmaz commented on GitHub (Jul 19, 2025):

I don't see the change. Am I missing something?

<!-- gh-comment-id:3091836684 --> @ismail-yilmaz commented on GitHub (Jul 19, 2025): I don't see the change. Am I missing something?
Author
Owner

@killerdevildog commented on GitHub (Jul 19, 2025):

void RichTxt::SetRefreshFrom(int parti)
{
r_type = FROM;
if(r_type == NONE)
r_parti = parti;
else
r_parti = min(parti, r_parti);
}

well shoot, I had one too many soda pops, I have a fix let me send a pull request.

<!-- gh-comment-id:3091886722 --> @killerdevildog commented on GitHub (Jul 19, 2025): void RichTxt::SetRefreshFrom(int parti) { r_type = FROM; if(r_type == NONE) r_parti = parti; else r_parti = min(parti, r_parti); } well shoot, I had one too many soda pops, I have a fix let me send a pull request.
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/ultimatepp#58
No description provided.