Skip to content

Commit aeeb165

Browse files
author
Fraser J. Gordon
committed
Disable existing tab-handling code
Because it hasn't been replaced, tabs do not work at all, currently...
1 parent 193b003 commit aeeb165

3 files changed

Lines changed: 25 additions & 18 deletions

File tree

engine/src/MCBlock.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ class MCBlock : public MCDLlist
105105

106106
bool fit(int2 x, uint2 width, findex_t& r_break_index, bool& r_break_fits);
107107
void split(findex_t p_index);
108-
int2 gettabwidth(int2 x, findex_t index);
109108
void drawstring(MCDC *dc, int2 x, int2 cx, int2 y, findex_t start, findex_t length, Boolean image, uint32_t style);
110109

111110
// MW-2012-02-27: [[ Bug 2939 ]] The 'flags' parameter indicates whether the left and/or

engine/src/block.cpp

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -765,15 +765,16 @@ bool MCBlock::fit(int2 x, uint2 maxwidth, findex_t& r_break_index, bool& r_break
765765
// MW-2013-11-07: [[ Bug 11393 ]] Previous per-platform implementations all fold into the optimized
766766
// case now (previously iOS / Windows printer were measuring break by break, which is what we do
767767
// generally now).
768-
if (t_this_char == '\t')
768+
// FG-2014-04-30: [[ TabAlignment ]] Blocks no longer contain tabs
769+
/*if (t_this_char == '\t')
769770
{
770771
twidth += gettabwidth(x + twidth, initial_i);
771772
twidth_float = (MCGFloat)twidth;
772773
773774
t_last_break_width = twidth;
774775
t_last_break_i = i;
775776
}
776-
else
777+
else*/
777778
{
778779
MCRange t_range;
779780
t_range = MCRangeMake(initial_i, i - initial_i);
@@ -827,7 +828,8 @@ void MCBlock::split(findex_t p_index)
827828
}
828829

829830
// Compute the distance between x and the next tab stop position.
830-
int2 MCBlock::gettabwidth(int2 x, findex_t i)
831+
// FG-2014-04-30: [[ TabAlignments ]] Blocks no longer contain tabs
832+
/*int2 MCBlock::gettabwidth(int2 x, findex_t i)
831833
{
832834
uint2 *tabs;
833835
uint2 ntabs;
@@ -939,7 +941,7 @@ int2 MCBlock::gettabwidth(int2 x, findex_t i)
939941
// Return the difference between x and the last tab.
940942
return lasttab - x;
941943
}
942-
}
944+
}*/
943945

944946
void MCBlock::drawstring(MCDC *dc, int2 x, int2 cx, int2 y, findex_t start, findex_t length, Boolean image, uint32_t style)
945947
{
@@ -970,12 +972,13 @@ void MCBlock::drawstring(MCDC *dc, int2 x, int2 cx, int2 y, findex_t start, find
970972
while(t_index < start + length)
971973
{
972974
uindex_t t_next_tab;
973-
if (MCStringFirstIndexOfChar(parent->GetInternalStringRef(), '\t', t_index, kMCStringOptionCompareExact, t_next_tab))
975+
// FG-2014-04-30: [[ TabAlignments ]] Blocks no longer contain tabs
976+
/*if (MCStringFirstIndexOfChar(parent->GetInternalStringRef(), '\t', t_index, kMCStringOptionCompareExact, t_next_tab))
974977
{
975978
if (t_next_tab >= m_index + m_size)
976979
t_next_tab = -1;
977980
}
978-
else
981+
else*/
979982
t_next_tab = -1;
980983

981984
findex_t t_next_index;
@@ -985,7 +988,7 @@ void MCBlock::drawstring(MCDC *dc, int2 x, int2 cx, int2 y, findex_t start, find
985988
t_next_index = t_next_tab;
986989

987990
int2 t_tab_width;
988-
t_tab_width = gettabwidth(0, t_index);
991+
t_tab_width = 64; //gettabwidth(0, t_index);
989992

990993
uint2 t_cell_right;
991994
t_cell_right = t_tab_width - t_delta;
@@ -1060,7 +1063,8 @@ void MCBlock::drawstring(MCDC *dc, int2 x, int2 cx, int2 y, findex_t start, find
10601063
if ((style & (FA_UNDERLINE | FA_STRIKEOUT)) != 0)
10611064
t_line_width = getsubwidth(dc, cx, start, size);
10621065

1063-
if (flags & F_HAS_TAB)
1066+
// FG-2014-04-30: [[ TabAlignments ]] Blocks no longer contain tabs
1067+
/*if (flags & F_HAS_TAB)
10641068
{
10651069
uindex_t eptr;
10661070
while (MCStringFirstIndexOfChar(parent->GetInternalStringRef(), '\t', sptr, kMCStringOptionCompareExact, eptr))
@@ -1094,7 +1098,7 @@ void MCBlock::drawstring(MCDC *dc, int2 x, int2 cx, int2 y, findex_t start, find
10941098
// sptr = l;
10951099
// size = length - l;
10961100
}
1097-
}
1101+
}*/
10981102

10991103
MCRange t_range;
11001104
t_range = MCRangeMake(sptr, size);
@@ -1780,8 +1784,9 @@ uint2 MCBlock::getsubwidth(MCDC *dc, int2 x, findex_t i, findex_t l)
17801784
// to 65535 - this means that we force wrapping when the line is too long.
17811785
// MW-2013-08-08: [[ Bug 10654 ]] Make sure we use a signed integer here, otherwise
17821786
// we get incorrect clamping when converted to unsigned.
1787+
// FG-2014-04-30: [[ TabAlignments ]] Blocks no longer contain tabs
17831788
int4 twidth = 0;
1784-
if (flags & F_HAS_TAB)
1789+
/*if (flags & F_HAS_TAB)
17851790
{
17861791
uindex_t eptr;
17871792
while (MCStringFirstIndexOfChar(parent->GetInternalStringRef(), '\t', sptr, kMCStringOptionCompareExact, eptr))
@@ -1803,7 +1808,7 @@ uint2 MCBlock::getsubwidth(MCDC *dc, int2 x, findex_t i, findex_t l)
18031808
sptr += sl;
18041809
l -= sl;
18051810
}
1806-
}
1811+
}*/
18071812
MCRange t_range;
18081813
t_range = MCRangeMake(sptr, l);
18091814
return MCU_min(65535, twidth + MCFontMeasureTextSubstring(m_font, parent->GetInternalStringRef(), t_range));
@@ -1816,7 +1821,8 @@ uint2 MCBlock::getwidth(MCDC *dc, int2 x)
18161821
return atts->image->getrect().width;
18171822
else if (dc != NULL && dc -> gettype() == CONTEXT_TYPE_PRINTER)
18181823
return getsubwidth(dc, x, m_index, m_size);
1819-
else if (width == 0 || flags & F_HAS_TAB)
1824+
// FG-2014-04-30 [[ TabAlignments ]] Blocks no longer contain tabs
1825+
else if (width == 0 /*|| flags & F_HAS_TAB*/)
18201826
return width = getsubwidth(dc, x, m_index, m_size);
18211827
else
18221828
return width;
@@ -2236,12 +2242,13 @@ void MCBlock::SetRange(findex_t p_index, findex_t p_length)
22362242
width = 0;
22372243

22382244
// Update the 'has tabs' flag
2239-
uindex_t t_where;
2245+
// FG-2014-04-30 [[ TabAlignments ]] Blocks no longer contain tabs
2246+
/*uindex_t t_where;
22402247
if (MCStringFirstIndexOfChar(parent->GetInternalStringRef(), '\t', m_index, kMCStringOptionCompareExact, t_where)
22412248
&& t_where < m_index + m_size)
22422249
flags |= F_HAS_TAB;
22432250
else
2244-
flags &= ~F_HAS_TAB;
2251+
flags &= ~F_HAS_TAB;*/
22452252
}
22462253

22472254
void MCBlock::MoveRange(findex_t p_index, findex_t p_length)
@@ -2252,12 +2259,13 @@ void MCBlock::MoveRange(findex_t p_index, findex_t p_length)
22522259
width = 0;
22532260

22542261
// Update the 'has tabs' flag
2255-
uindex_t t_where;
2262+
// FG-2014-04-30 [[ TabAlignments ]] Blocks no longer contain tabs
2263+
/*uindex_t t_where;
22562264
if (MCStringFirstIndexOfChar(parent->GetInternalStringRef(), '\t', m_index, kMCStringOptionCompareExact, t_where)
22572265
&& t_where < m_index + m_size)
22582266
flags |= F_HAS_TAB;
22592267
else
2260-
flags &= ~F_HAS_TAB;
2268+
flags &= ~F_HAS_TAB;*/
22612269
}
22622270

22632271
codepoint_t MCBlock::GetCodepointAtIndex(findex_t p_index) const

engine/src/objdefs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ along with LiveCode. If not see <http://www.gnu.org/licenses/>. */
293293
#define F_HAS_SHIFT (1UL << 16)
294294
#define F_HAS_BACK_COLOR (1UL << 17)
295295
#define F_HAS_COLOR_NAME (1UL << 18)
296-
#define F_HAS_TAB (1UL << 19)
296+
//#define F_HAS_TAB (1UL << 19) // [[ TabAlignment ]] No longer required
297297
#define F_HAS_BACK_COLOR_NAME (1UL << 20)
298298
#define F_HAS_LINK (1UL << 21)
299299
#define F_HAS_IMAGE (1UL << 22)

0 commit comments

Comments
 (0)