Skip to content

Commit 19b812d

Browse files
[[ RefactorSyntax ]] Fix infinite loop in getting width
Reverted change on scrollbars settings
1 parent ab55132 commit 19b812d

2 files changed

Lines changed: 4 additions & 7 deletions

File tree

engine/src/block.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1692,6 +1692,7 @@ uint2 MCBlock::getsubwidth(MCDC *dc, int2 x, findex_t i, findex_t l)
16921692
else
16931693
{
16941694
findex_t sptr = i;
1695+
findex_t t_length = l;
16951696

16961697
// MW-2012-02-12: [[ Bug 10662 ]] If the last char is a VTAB then ignore it.
16971698
if (parent->TextIsLineBreak(parent->GetCodepointAtIndex(sptr + l - 1)))
@@ -1708,7 +1709,7 @@ uint2 MCBlock::getsubwidth(MCDC *dc, int2 x, findex_t i, findex_t l)
17081709
while (MCStringFirstIndexOfChar(parent->GetInternalStringRef(), '\t', sptr, kMCStringOptionCompareExact, eptr))
17091710
{
17101711
// Break if we've gone past the end of this block
1711-
if (eptr >= m_size)
1712+
if (eptr >= i + t_length)
17121713
break;
17131714

17141715
MCRange t_range;

engine/src/exec-interface-field.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -567,9 +567,7 @@ void MCField::GetHScrollbar(MCExecContext& ctxt, bool& r_setting)
567567

568568
void MCField::SetHScrollbar(MCExecContext& ctxt, bool setting)
569569
{
570-
setflag(setting, F_HSCROLLBAR);
571-
572-
if (setting)
570+
if (changeflag(setting, F_HSCROLLBAR))
573571
{
574572

575573
DoSetHScrollbar(ctxt, hscrollbar, scrollbarwidth);
@@ -584,9 +582,7 @@ void MCField::GetVScrollbar(MCExecContext& ctxt, bool& r_setting)
584582

585583
void MCField::SetVScrollbar(MCExecContext& ctxt, bool setting)
586584
{
587-
setflag(setting, F_VSCROLLBAR);
588-
589-
if (setting)
585+
if (changeflag(setting, F_VSCROLLBAR))
590586
{
591587
DoSetVScrollbar(ctxt, vscrollbar, scrollbarwidth);
592588
Redraw(true, textx, texty);

0 commit comments

Comments
 (0)