Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-4462

First line in Console duplicated

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 0.11.0
    • 0.12.0
    • Delphi - Library
    • None
    • Patch Available

    Description

      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;

      Attachments

        1. Thrift.Console.patch
          0.3 kB
          Anton Shchyrov

        Activity

          People

            jensg Jens Geyer
            AntonTramp Anton Shchyrov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: