Browse Source

* syntax highlight fixes
* browser updates

peter 26 years ago
parent
commit
77e2d5ad2a
6 changed files with 98 additions and 57 deletions
  1. 6 2
      ide/text/fpdesk.pas
  2. 10 6
      ide/text/fpsymbol.pas
  3. 32 27
      ide/text/fputils.pas
  4. 6 2
      ide/text/fpviews.pas
  5. 9 0
      ide/text/test.pas
  6. 35 20
      ide/text/weditor.pas

+ 6 - 2
ide/text/fpdesk.pas

@@ -72,6 +72,7 @@ end;
 function WriteOpenWindows(F: PResourceFile): boolean;
 var S: PMemoryStream;
 begin
+  WriteOpenWindows:=true;
   {$ifndef DEV}Exit;{$endif}
 
   New(S, Init(1024*1024,4096));
@@ -80,7 +81,6 @@ begin
   F^.CreateResource(resDesktop,rcBinary,0);
   F^.AddResourceEntryFromStream(resDesktop,langDefault,0,S^,S^.GetSize);
   Dispose(S, Done);
-  WriteOpenWindows:=true;
 end;
 
 function WriteSymbols(F: PResourceFile): boolean;
@@ -118,7 +118,11 @@ end;
 END.
 {
   $Log$
-  Revision 1.3  1999-04-07 21:55:45  peter
+  Revision 1.4  1999-04-15 08:58:05  peter
+    * syntax highlight fixes
+    * browser updates
+
+  Revision 1.3  1999/04/07 21:55:45  peter
     + object support for browser
     * html help fixes
     * more desktop saving things

+ 10 - 6
ide/text/fpsymbol.pas

@@ -911,13 +911,13 @@ begin
               MakeGlobal(ScopeView^.Origin,P);
               Desktop^.MakeLocal(P,P); Inc(P.Y,ScopeView^.Focused-ScopeView^.TopItem);
               Inc(P.Y);
-              if (S^.GetReferenceCount>0) or (S^.GetItemCount>0) then
               if S^.Ancestor=nil then Anc:=nil else
                 Anc:=SearchObjectForSymbol(S^.Ancestor);
-              OpenSymbolBrowser(Origin.X-1,P.Y,
-                S^.GetName,
-                ScopeView^.GetText(ScopeView^.Focused,255),S,
-                S^.Items,S^.References,Anc,S^.MemInfo);
+              if (S^.GetReferenceCount>0) or (S^.GetItemCount>0) or (Anc<>nil) then
+               OpenSymbolBrowser(Origin.X-1,P.Y,
+                 S^.GetName,
+                 ScopeView^.GetText(ScopeView^.Focused,255),S,
+                 S^.Items,S^.References,Anc,S^.MemInfo);
             end;
       end;
 {    evCommand :
@@ -1078,7 +1078,11 @@ end;
 END.
 {
   $Log$
-  Revision 1.14  1999-04-07 21:55:53  peter
+  Revision 1.15  1999-04-15 08:58:06  peter
+    * syntax highlight fixes
+    * browser updates
+
+  Revision 1.14  1999/04/07 21:55:53  peter
     + object support for browser
     * html help fixes
     * more desktop saving things

+ 32 - 27
ide/text/fputils.pas

@@ -406,32 +406,33 @@ function MatchesMask(What, Mask: string): boolean;
     i1:=0;
     i2:=0;
     found:=true;
-    repeat
-      if found then
-       inc(i2);
-      inc(i1);
-      case hstr1[i1] of
-        '?' :
-          found:=true;
-        '*' :
-          begin
-            found:=true;
-            if (i1=length(hstr1)) then
-             i2:=length(hstr2)
-            else
-             if (i1<length(hstr1)) and (hstr1[i1+1]<>hstr2[i2]) then
-              begin
-                if i2<length(hstr2) then
-                 dec(i1)
-              end
-            else
-             if i2>1 then
-              dec(i2);
-          end;
-        else
-          found:=(hstr1[i1]=hstr2[i2]) or (hstr2[i2]='?');
-      end;
-    until (i1>=length(hstr1)) or (i2>length(hstr2)) or (not found);
+    while found and (i1<length(hstr1)) and (i2<=length(hstr2)) do
+     begin
+       if found then
+        inc(i2);
+       inc(i1);
+       case hstr1[i1] of
+         '?' :
+           found:=true;
+         '*' :
+           begin
+             found:=true;
+             if (i1=length(hstr1)) then
+              i2:=length(hstr2)
+             else
+              if (i1<length(hstr1)) and (hstr1[i1+1]<>hstr2[i2]) then
+               begin
+                 if i2<length(hstr2) then
+                  dec(i1)
+               end
+             else
+              if i2>1 then
+               dec(i2);
+           end;
+         else
+           found:=(hstr1[i1]=hstr2[i2]) or (hstr2[i2]='?');
+       end;
+     end;
     if found then
       found:=(i1>=length(hstr1)) and (i2>=length(hstr2));
     CmpStr:=found;
@@ -646,7 +647,11 @@ end;
 END.
 {
   $Log$
-  Revision 1.12  1999-04-07 21:55:55  peter
+  Revision 1.13  1999-04-15 08:58:07  peter
+    * syntax highlight fixes
+    * browser updates
+
+  Revision 1.12  1999/04/07 21:55:55  peter
     + object support for browser
     * html help fixes
     * more desktop saving things

+ 6 - 2
ide/text/fpviews.pas

@@ -2258,7 +2258,7 @@ var D : DirStr;
             SName:=PSourceWindow(W)^.Editor^.FileName;
           SName:=UpcaseStr(SName);
 
-          if E<>'' then
+          if (E<>'') or (not tryexts) then
             begin
               if D<>'' then
                 Found:=SName=UpcaseStr(D+N+E)
@@ -2606,7 +2606,11 @@ end;
 END.
 {
   $Log$
-  Revision 1.28  1999-04-07 21:55:56  peter
+  Revision 1.29  1999-04-15 08:58:08  peter
+    * syntax highlight fixes
+    * browser updates
+
+  Revision 1.28  1999/04/07 21:55:56  peter
     + object support for browser
     * html help fixes
     * more desktop saving things

+ 9 - 0
ide/text/test.pas

@@ -27,6 +27,15 @@ type
         procedure Proc; virtual;
       end;
 
+      TObj3  = object(TObj)
+      end;
+
+      TObj32 = object(TObj3)
+      end;
+
+      TObj4 = object(TObj)
+      end;
+
       TClass = class
         constructor Create;
       end;

+ 35 - 20
ide/text/weditor.pas

@@ -337,8 +337,10 @@ const
      FindFlags          : word = ffPromptOnReplace;
      WhiteSpaceChars    : set of char = [#0,#32,#255];
      TabChars           : set of char = [#9];
+     HashChars          : set of char = ['#'];
      AlphaChars         : set of char = ['A'..'Z','a'..'z','_'];
      NumberChars        : set of char = ['0'..'9'];
+     RealNumberChars    : set of char = ['E','e','.','+','-'];
      DefaultSaveExt     : string[12] = '.pas';
 
      UseSyntaxHighlight : function(Editor: PFileEditor): boolean = DefUseSyntaxHighlight;
@@ -1594,7 +1596,8 @@ begin
       if DT[p]=#9 then
        begin
          PAdd:=TabSize-((p-1) mod TabSize);
-         DF:=copy(DF,1,P-1)+CharStr(DF[p],PAdd)+copy(DF,P+1,255);
+         if DF<>'' then
+          DF:=copy(DF,1,P-1)+CharStr(DF[p],PAdd)+copy(DF,P+1,255);
          DT:=copy(DT,1,P-1)+CharStr(' ',PAdd)+copy(DT,P+1,255);
          inc(P,PAdd-1);
        end;
@@ -2573,7 +2576,7 @@ end;
 
 function TCodeEditor.UpdateAttrs(FromLine: integer; Attrs: byte): integer;
 type
-    TCharClass = (ccWhiteSpace,ccTab,ccAlpha,ccNumber,ccSymbol);
+    TCharClass = (ccWhiteSpace,ccTab,ccAlpha,ccNumber,ccRealNumber,ccHash,ccSymbol);
 var
   SymbolIndex: Sw_integer;
   CurrentCommentType : Byte;
@@ -2666,8 +2669,10 @@ var
   begin
     if C in WhiteSpaceChars then CC:=ccWhiteSpace else
     if C in TabChars then CC:=ccTab else
-    if C in AlphaChars      then CC:=ccAlpha else
-    if C in NumberChars     then CC:=ccNumber else
+    if C in HashChars then CC:=ccHash else
+    if C in AlphaChars then CC:=ccAlpha else
+    if C in NumberChars then CC:=ccNumber else
+    if (LastCC=ccNumber) and (C in RealNumberChars) then CC:=ccRealNumber else
     CC:=ccSymbol;
     GetCharClass:=CC;
   end;
@@ -2688,18 +2693,22 @@ var
     case SClass of
       ccWhiteSpace : C:=coWhiteSpaceColor;
       ccTab : C:=coTabColor;
-      ccNumber     : if copy(WordS,1,1)='$' then
-             C:=coHexNumberColor
-           else
-             C:=coNumberColor;
-      ccSymbol     : C:=coSymbolColor;
-      ccAlpha      :
-   begin
-     if IsReservedWord(WordS) then
-       C:=coReservedWordColor
-     else
-       C:=coIdentifierColor;
-   end;
+      ccNumber :
+        if copy(WordS,1,1)='$' then
+          C:=coHexNumberColor
+        else
+          C:=coNumberColor;
+      ccHash :
+        C:=coStringColor;
+      ccSymbol :
+        C:=coSymbolColor;
+      ccAlpha :
+        begin
+          if IsReservedWord(WordS) then
+            C:=coReservedWordColor
+          else
+            C:=coIdentifierColor;
+        end;
     end;
     if EndX+1>=StartX then
       FillChar(Format[StartX],EndX+1-StartX,C);
@@ -2715,7 +2724,9 @@ var
     CC:=GetCharClass(C);
     if ( (CC<>LastCC) and
          ( (CC<>ccAlpha) or (LastCC<>ccNumber) ) and
-         ( (CC<>ccNumber) or (LastCC<>ccAlpha) )
+         ( (CC<>ccNumber) or (LastCC<>ccAlpha) ) and
+         ( (CC<>ccNumber) or (LastCC<>ccHash) ) and
+         ( (CC<>ccRealNumber) or (LastCC<>ccNumber) )
        ) or
        (X>length(LineText)) or (CC=ccSymbol) then
     begin
@@ -3207,9 +3218,9 @@ begin
        SH:=UseSyntaxHighlight(@Self);
        if SH<>B then
          if SH then
-      SetFlags(Flags or efSyntaxHighlight)
+           SetFlags(Flags or efSyntaxHighlight)
          else
-      SetFlags(Flags and not efSyntaxHighlight);
+           SetFlags(Flags and not efSyntaxHighlight);
        if UseTabsPattern(@Self) then
          SetFlags(Flags or efUseTabCharacters);
      end;
@@ -3502,7 +3513,11 @@ end;
 END.
 {
   $Log$
-  Revision 1.29  1999-04-07 21:55:59  peter
+  Revision 1.30  1999-04-15 08:58:10  peter
+    * syntax highlight fixes
+    * browser updates
+
+  Revision 1.29  1999/04/07 21:55:59  peter
     + object support for browser
     * html help fixes
     * more desktop saving things