[ https://issues.apache.org/jira/browse/THRIFT-4462?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Anton Shchyrov updated THRIFT-4462: ----------------------------------- Description: Method Console.Write/WriteLine in class TGUIConsole after called method *Write* and clear log duplicates current message {code:java} ChangeConsole(TGUIConsole.Create(Memo1.Lines)); Console.Write('String'); // Set internal FLineBreak to False Memo1.Lines.Clear; Console.Write('Some String'); // Log have "Some StringSome String" Reason in method procedure TGUIConsole.InternalWrite(const S: string; bWriteLine: Boolean); var idx : Integer; begin if FLineBreak then begin FMemo.Add( S ); end else begin idx := FMemo.Count - 1; if idx < 0 then begin FMemo.Add( S ); end; FMemo[idx] := FMemo[idx] + S; end; FLineBreak := bWriteLine; end; {code} If FMemo.Count = 0 then idx = -1 and string added to log. But next line {code:java} FMemo[idx] := FMemo[idx] + S;{code} repeats the added string. should be {code:java} if idx < 0 then begin FMemo.Add( S ); end else FMemo[idx] := FMemo[idx] + S;{code} was: Method Console.Write/WriteLine in class TGUIConsole after called method *Write* and clear log duplicates current message {{ChangeConsole(TGUIConsole.Create(Memo1.Lines));}} {{Console.Write('String'); // Set internal FLineBreak to False}} {{Memo1.Lines.Clear;}} {{Console.Write('Some String'); // Log have "Some StringSome String"}} Reason in method {{procedure TGUIConsole.InternalWrite(const S: string; bWriteLine: Boolean);}} {{var}} {{ idx : Integer;}} {{begin}} {{ if FLineBreak then}} {{ begin}} {{ FMemo.Add( S );}} {{ end else}} {{ begin}} {{ idx := FMemo.Count - 1;}} {{ if idx < 0 then}} {{ begin}} {{ FMemo.Add( S );}} {{ end;}} {{ FMemo[idx] := FMemo[idx] + S;}} {{ end;}} {{ FLineBreak := bWriteLine;}} {{end;}} If FMemo.Count = 0 then idx = -1 and string added to log. But next line {{FMemo[idx] := FMemo[idx] + S;}} repeats the added string. should be if idx < 0 then begin FMemo.Add( S ); end *else* FMemo[idx] := FMemo[idx] + S; > First line in Console duplicated > -------------------------------- > > Key: THRIFT-4462 > URL: https://issues.apache.org/jira/browse/THRIFT-4462 > Project: Thrift > Issue Type: Bug > Components: Delphi - Library > Affects Versions: 0.11.0 > Reporter: Anton Shchyrov > Assignee: Jens Geyer > Priority: Minor > Fix For: 0.12.0 > > Attachments: Thrift.Console.patch > > > Method Console.Write/WriteLine in class TGUIConsole after called method > *Write* and clear log duplicates current message > > {code:java} > ChangeConsole(TGUIConsole.Create(Memo1.Lines)); > Console.Write('String'); // Set internal FLineBreak to False > Memo1.Lines.Clear; > Console.Write('Some String'); // Log have "Some StringSome String" > Reason in method > procedure TGUIConsole.InternalWrite(const S: string; bWriteLine: Boolean); > var > idx : Integer; > begin > if FLineBreak then > begin > FMemo.Add( S ); > end else > begin > idx := FMemo.Count - 1; > if idx < 0 then > begin > FMemo.Add( S ); > end; > FMemo[idx] := FMemo[idx] + S; > end; > FLineBreak := bWriteLine; > end; > {code} > If FMemo.Count = 0 then idx = -1 and string added to log. But next line > {code:java} > FMemo[idx] := FMemo[idx] + S;{code} > repeats the added string. should be > {code:java} > if idx < 0 then > begin > FMemo.Add( S ); > end else > FMemo[idx] := FMemo[idx] + S;{code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)