View Issue Details

IDProjectCategoryView StatusLast Update
0021600LazarusIDEpublic2012-03-30 09:53
Reportercobines Assigned ToJuha Manninen  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
PlatformWin32OSWindows XP 
Product Version0.9.31 (SVN) 
Summary0021600: Reduce BeginUpdate/EndUpdate calls to Messages window while building
DescriptionThe OutputFilter currently issues many BeginUpdate/EndUpdate calls without any changes in between. This results in unnecessary repaints of the Messages window.
Attached patch makes BeginUpdate to be called only just before some change is made.
TagsNo tags attached.
Fixed in Revisionr36443
LazTarget-
Widgetset
Attached Files

Activities

2012-03-30 01:18

 

no_empty_beginendupdate.diff (3,759 bytes)   
Index: ide/outputfilter.pas
===================================================================
--- ide/outputfilter.pas	(revision 36431)
+++ ide/outputfilter.pas	(working copy)
@@ -107,6 +107,7 @@
   private
     FAsyncDataAvailable: boolean;
     FAsyncProcessTerminated: boolean;
+    FAutoBeginUpdate: boolean;
     FLastAsyncExecuteTime: TDateTime;
     FCaller: TObject;
     FFinishedCallback: TNotifyEvent;
@@ -144,6 +145,7 @@
     DarwinLinkerLine : String;
     FErrorNames : array [TFPCErrorType] of string; {customizable error names}
     fLastBuffer: TCodeBuffer;
+    FUpdating: Boolean;
     procedure DoAddFilteredLine(const s: string; OriginalIndex: integer = -1);
     procedure DoAddLastLinkerMessages(SkipLastLine: boolean);
     procedure DoAddLastAssemblerMessages;
@@ -259,6 +261,8 @@
   FStopExecute:=false;
   fLastSearchedShortIncFilename:='';
   fLastSearchedIncFilename:='';
+  FUpdating:=false;
+  FAutoBeginUpdate:=true;
 end;
 
 procedure TOutputFilter.InitExecute;
@@ -321,7 +325,6 @@
   OutputLine, Buf : String;
   TheAsyncProcess: TAsyncProcess;
   LastProcessMessages: TDateTime;
-  EndUpdateNeeded: Boolean;
   ExceptionMsg: String;
   Wait: double;
 begin
@@ -340,7 +343,6 @@
   SetLength(Buf,BufSize);
   OutputLine:='';
   TheAsyncProcess:=nil;
-  EndUpdateNeeded:=false;
   ExceptionMsg:='';
 
   try
@@ -368,14 +370,10 @@
       if (Application<>nil) and (abs(LastProcessMessages-Now)>Wait)
       then begin
         LastProcessMessages:=Now;
-        if EndUpdateNeeded then begin
-          EndUpdateNeeded:=false;
+        if FUpdating then
           EndUpdate;
-        end;
         Application.ProcessMessages;
         Application.Idle(false);
-        BeginUpdate;
-        EndUpdateNeeded:=true;
       end;
       if StopExecute then begin
         fProcess.Terminate(0);
@@ -456,7 +454,7 @@
     {$IFDEF VerboseOFExecute}
     WriteLn('TOutputFilter.Execute W1');
     {$ENDIF}
-    if EndUpdateNeeded then
+    if FUpdating then
       EndUpdate;
     CleanUpExecute;
   end;
@@ -551,8 +549,6 @@
     SetLength(Buf,BufSize);
     OutputLine:='';
     try
-      BeginUpdate;
-
       repeat
         // Read data
         Count:=0;
@@ -613,7 +609,8 @@
       FLastAsyncExecuteTime := AsyncExecuteTime;
       if (FState = ofsSucceded) and FHasReadErrorLine then
         FState := ofsFailed;
-      EndUpdate;
+      if FUpdating then
+        EndUpdate;
       if FState = ofsRunning then
         Application.QueueAsyncCall(@ContinueAsyncExecute, 0)
       else begin
@@ -648,6 +645,8 @@
       s:=FScanLine.Line;
     end;
     if Assigned(OnReadLine) then begin
+      if not FUpdating and FAutoBeginUpdate then
+        BeginUpdate;
       OnReadLine(FScanLine);
       s:=FScanLine.Line;
     end;
@@ -676,7 +675,9 @@
   Line: String;
 begin
   Line:=s;
+  FAutoBeginUpdate := false;
   ReadLine(Line,DontFilterLine);
+  FAutoBeginUpdate := true;
 end;
 
 function TOutputFilter.ReadFPCompilerLine(const s: string): boolean;
@@ -1320,7 +1321,11 @@
   fFilteredOutput.Add(s);
   fFilteredOutput.OriginalIndices[fFilteredOutput.Count-1]:=OriginalIndex;
   if Assigned(OnAddFilteredLine) then
+  begin
+    if not FUpdating and FAutoBeginUpdate then
+      BeginUpdate;
     OnAddFilteredLine(s,fCurrentDirectory,OriginalIndex,CurrentMessageParts);
+  end;
 end;
 
 procedure TOutputFilter.DoAddLastLinkerMessages(SkipLastLine: boolean);
@@ -1694,11 +1699,13 @@
 procedure TOutputFilter.BeginUpdate;
 begin
   if Assigned(OnBeginUpdate) then OnBeginUpdate(Self);
+  FUpdating:=true;
 end;
 
 procedure TOutputFilter.EndUpdate;
 begin
   if Assigned(OnEndUpdate) then OnEndUpdate(Self);
+  FUpdating:=false;
 end;
 
 procedure TOutputFilter.RaiseOutputFilterError(const Msg: string);
no_empty_beginendupdate.diff (3,759 bytes)   

Juha Manninen

2012-03-30 08:09

developer   ~0058187

Applied, thanks.

Issue History

Date Modified Username Field Change
2012-03-30 01:18 cobines New Issue
2012-03-30 01:18 cobines File Added: no_empty_beginendupdate.diff
2012-03-30 08:06 Juha Manninen Status new => assigned
2012-03-30 08:06 Juha Manninen Assigned To => Juha Manninen
2012-03-30 08:09 Juha Manninen Fixed in Revision => r36443
2012-03-30 08:09 Juha Manninen LazTarget => -
2012-03-30 08:09 Juha Manninen Status assigned => resolved
2012-03-30 08:09 Juha Manninen Resolution open => fixed
2012-03-30 08:09 Juha Manninen Note Added: 0058187
2012-03-30 09:53 cobines Status resolved => closed