Skip to content

Commit 71b98a3

Browse files
Merge pull request livecode#1620 from runrevsebastien/bugfix-14161
[[ Bug 14161 ]] Only forces re-layout of paragraphs after a prop setting...
2 parents c47c656 + 92e21af commit 71b98a3

4 files changed

Lines changed: 15 additions & 7 deletions

File tree

docs/notes/bugfix-14161.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# V7.0.1-rc3 IDE is slow

engine/src/exec-interface-field-chunk.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -874,11 +874,13 @@ MCParagraph* PrepareLayoutSettings(bool all, MCField *p_field, uint32_t p_part_i
874874

875875
// SN-2014-11-04: [[ Bug 13934 ]] Update the area of the field to redraw,
876876
// depending on the paragraph settings.
877-
void LayoutParagraph(MCParagraph* p_paragraph, MCFieldLayoutSettings &x_layout_settings)
877+
// SN-2014-12-18: [[ Bug 14161 ]] Add a parameter to force the re-layout of a paragraph
878+
void LayoutParagraph(MCParagraph* p_paragraph, MCFieldLayoutSettings &x_layout_settings, bool p_force)
878879
{
879880
// AL-2014-07-14: [[ Bug 12789 ]] Defragging can cause paragraph to need layout, do make sure we relayout
880881
// if it did. Otherwise setting properties that avoid relayout can cause crashes.
881-
if (p_paragraph -> getneedslayout() && !x_layout_settings . all && p_paragraph->getopened())
882+
// SN-2014-12-18: [[ Bug 14161 ]] The relayout can be forced
883+
if (p_force || (p_paragraph -> getneedslayout() && !x_layout_settings . all && p_paragraph->getopened()))
882884
{
883885
// MW-2012-01-25: [[ ParaStyles ]] Ask the paragraph to reflow itself.
884886
// AL-2014-09-22: [[ Bug 11817 ]] If we changed the amount of lines of this paragraph
@@ -938,7 +940,8 @@ template<typename T> void SetParagraphPropOfCharChunk(MCExecContext& ctxt, MCFie
938940
sptr -> cleanattrs();
939941

940942
// SN-2014-11-04: [[ Bug 13934 ]] Laying out a field refactored.
941-
LayoutParagraph(sptr, t_layout_settings);
943+
// SN-2014-12-18: [[ Bug 14161 ]] Forces the re-layout of this paragraph which has been changed
944+
LayoutParagraph(sptr, t_layout_settings, true);
942945

943946
ei -= sptr->gettextlengthcr();
944947
sptr = sptr->next();
@@ -1108,7 +1111,8 @@ template<typename T> void SetCharPropOfCharChunk(MCExecContext& ctxt, MCField *p
11081111
// end of MCParagraph scope
11091112

11101113
// SN-2014-11-04: [[ Bug 13934 ]] Laying out a field refactored.
1111-
LayoutParagraph(pgptr, t_layout_settings);
1114+
// SN-2014-12-18: [[ Bug 14161 ]] Add a parameter to force the re-layout of a paragraph
1115+
LayoutParagraph(pgptr, t_layout_settings, false);
11121116
}
11131117

11141118
si = MCU_max(0, si - t_pg_length);
@@ -1218,7 +1222,8 @@ template<typename T> void SetArrayCharPropOfCharChunk(MCExecContext& ctxt, MCFie
12181222
// end of MCParagraph scope
12191223

12201224
// SN-2014-11-04: [[ Bug 13934 ]] Laying out a field refactored.
1221-
LayoutParagraph(pgptr, t_layout_settings);
1225+
// SN-2014-12-18: [[ Bug 14161 ]] Add a parameter to force the re-layout of a paragraph
1226+
LayoutParagraph(pgptr, t_layout_settings, false);
12221227
}
12231228

12241229
si = MCU_max(0, si - t_pg_length);

engine/src/exec-interface-field.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,8 @@ MCExecCustomTypeInfo *kMCInterfaceFieldTabAlignmentsTypeInfo = &_kMCInterfaceFie
323323
void MCField::Relayout(bool reset, int4 xoffset, int4 yoffset)
324324
{
325325
// SN-2014-11-24: [[ Bug 14053 ]] do_recompute was always called with true in 6.x (needed for the text alignment)
326-
do_recompute(true);
326+
// SN-2014-12-18: [[ Bug 14161 ]] We don't want to recompute all the paragraphs of a field at any change
327+
do_recompute(reset);
327328

328329
if (reset)
329330
resetparagraphs();

engine/src/field.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,8 @@ class MCField : public MCControl
251251

252252
// SN-2014-11-04: [[ Bug 13934 ]] Refactor the laying out the field when setting properties
253253
friend MCParagraph* PrepareLayoutSettings(bool all, MCField *p_field, uint32_t p_part_id, findex_t &si, findex_t &ei, MCFieldLayoutSettings &r_layout_settings);
254-
friend void LayoutParagraph(MCParagraph *p_paragraph, MCFieldLayoutSettings &x_settings);
254+
// SN-2014-12-18: [[ Bug 14161 ]] Add a parameter to force the re-layout of a paragraph
255+
friend void LayoutParagraph(MCParagraph* p_paragraph, MCFieldLayoutSettings &x_layout_settings, bool p_force);
255256
friend void FinishLayout(MCFieldLayoutSettings &x_settings);
256257

257258
MCField();

0 commit comments

Comments
 (0)