Browse Source

Correctly display pchar longer than high(string) nito several lines in TGDBWindow.WriteText method

git-svn-id: trunk@29755 -
pierre 10 years ago
parent
commit
6887eb739a
1 changed files with 13 additions and 10 deletions
  1. 13 10
      ide/fpviews.pas

+ 13 - 10
ide/fpviews.pas

@@ -2579,7 +2579,10 @@ begin
   While assigned(p) and (p^<>#0) do
   While assigned(p) and (p^<>#0) do
     begin
     begin
        pe:=strscan(p,#10);
        pe:=strscan(p,#10);
-       if pe<>nil then
+       { if pe-p is more than High(s), discard for this round }
+       if (pe<>nil) and (pe-p > high(s)) then
+         pe:=nil;
+       if (pe<>nil)  then
          pe^:=#0;
          pe^:=#0;
        s:=strpas(p);
        s:=strpas(p);
        If IsError then
        If IsError then
@@ -2590,16 +2593,16 @@ begin
        if pe<>nil then
        if pe<>nil then
          pe^:=#10;
          pe^:=#10;
        if pe=nil then
        if pe=nil then
-         p:=nil
-       else
          begin
          begin
-           if pe-p > High(s) then
-             p:=p+High(s)-1
+           if strlen(p)<High(s) then
+             p:=nil
            else
            else
-             begin
-               p:=pe;
-               inc(p);
-             end;
+             p:=p+High(s);
+         end
+       else
+         begin
+           p:=pe;
+           inc(p);
          end;
          end;
     end;
     end;
   DeskTop^.Unlock;
   DeskTop^.Unlock;
@@ -4390,7 +4393,7 @@ begin
               Message(W,evCommand,cmAddChar,pointer(ptrint(ord(Report^.AsciiChar))));
               Message(W,evCommand,cmAddChar,pointer(ptrint(ord(Report^.AsciiChar))));
             ClearEvent(Event);
             ClearEvent(Event);
           end;
           end;
-        
+
         cmSearchWindow+1..cmSearchWindow+99 :
         cmSearchWindow+1..cmSearchWindow+99 :
           if (Event.Command-cmSearchWindow=Number) then
           if (Event.Command-cmSearchWindow=Number) then
               ClearEvent(Event);
               ClearEvent(Event);