If I applied wordwrap, begins appear error on opening binary files. Previously I can't localized because it trash memory and caused error fat away. But is good thing - range checking:
In TSynEditStringTabExpander.ExpandedString"
CharWidths := GetPhysicalCharWidths(Pchar(Line), length(Line), Index);
l := 0;
for i := 0 to length(CharWidths)-1 do
l := l + (CharWidths[i] and PCWMask);
SetLength(Result, l); <--here set length to 91
l := 1;
for i := 1 to length(CharWidths) do begin
if Line[i] <> #9 then begin
Result[l] := Line[i];<--error when l=92, length(CharWidths)=118
inc(l);
end else begin
for j := 1 to (CharWidths[i-1] and PCWMask) do begin
Result[l] := ' ';
inc(l);
end;
end;
end;
CharWidths in debugger:
Len=118:
(1,
0,
1,
0,
0,
...)
What mean CharWidths? 0 is len of bad UTF8 code? How correct it?
To line #9: CharWidths is only about tabs? if this will be corrected:
if CharWidths[i]=0 then continue;
In TSynEditStringTabExpander.DoGetPhysicalCharWidths is
for i := 0 to LineLen - 1 do begin
if (PWidths^ and PCWMask) <> 0 then begin
if Line^ = #9 then begin
PWidths^ := (FTabWidth - (j mod FTabWidth) and PCWMask) or (PWidths^ and (not PCWMask));
HasTab := True;
end;
j := j + (PWidths^ and PCWMask);
end;
inc(Line);
inc(PWidths);
end;
It calls inherited TSynEditStringBidiChars.DoGetPhysicalCharWidths where are
#$09, //Segment_Separator
#$20, // White_Space
#$21..#$22, #$26..#$2A, // Other_Neutral
#$2B, #$2D, // EN (European Seperator)
#$23..#$25, // European Terminator
#$2C, #$2E, #$3A, // Common Separator
#$3B..#$40, #$5B..#$60, #$7B..#$7E // Other_Neutral
etc..
In normal tabbed lines it is:
1 1 1 1 1 3 1 1 1
only 1's and 1 to tabWidth for tabs, no zeros
how handle zeros? Should avoid 0's in table CharWidths or do with 0's in ExpandedString?