Browse Source

merges from fixes branch

pierre 25 years ago
parent
commit
53b0ce0780

+ 5 - 5
ide/text/Makefile

@@ -1,5 +1,5 @@
 #
-# Makefile generated by fpcmake v1.00 [2000/10/27]
+# Makefile generated by fpcmake v1.00 [2000/10/25]
 #
 
 defaultrule: all
@@ -227,11 +227,11 @@ GDBINT=gdbint
 endif
 
 ifeq ($(GDB),1)
-GDBLIBDIR+=$(PACKAGESDIR)/$(GDBINT)/libgdb/$(OS_TARGET)
-GDBOBJDIR+=$(PACKAGESDIR)/$(GDBINT)/libgdb/$(OS_TARGET)
+override GDBLIBDIR+=$(PACKAGESDIR)/$(GDBINT)/libgdb/$(OS_TARGET)
+override GDBOBJDIR+=$(PACKAGESDIR)/$(GDBINT)/libgdb/$(OS_TARGET)
 ifeq ($(OS_TARGET),go32v2)
 ifneq ($(DJDIR),)
-GDBLIBDIR+=$(DJDIR)/lib
+override GDBLIBDIR+=$(DJDIR)/lib
 endif
 endif
 ifeq ($(strip $(wildcard $(addsuffix /libgdb.a,$(GDBLIBDIR)))),)
@@ -1250,7 +1250,7 @@ else
 	$(MAKE) $(ZIPTARGET) PREFIXINSTALLDIR=$(PACKDIR)
 ifdef USETAR
 	$(DEL) $(DESTZIPDIR)/$(ZIPNAME)$(TAREXT)
-	cd $(PACKDIR) ; $(TARPROG) cf$(TAROPT) $(DESTZIPDIR)/$(ZIPNAME)$(TAREXT) * ; cd $(BASEDIR)
+	cd $(PACKDIR) ; $(TARPROG) c$(TAROPT) --file $(DESTZIPDIR)/$(ZIPNAME)$(TAREXT) * ; cd $(BASEDIR)
 else
 	$(DEL) $(DESTZIPDIR)/$(ZIPNAME)$(ZIPEXT)
 	cd $(PACKDIR) ; $(ZIPPROG) -Dr $(ZIPOPT) $(DESTZIPDIR)/$(ZIPNAME)$(ZIPEXT) * ; cd $(BASEDIR)

+ 7 - 5
ide/text/Makefile.fpc

@@ -36,11 +36,11 @@ GDBINT=gdbint
 endif
 
 ifeq ($(GDB),1)
-GDBLIBDIR+=$(PACKAGESDIR)/$(GDBINT)/libgdb/$(OS_TARGET)
-GDBOBJDIR+=$(PACKAGESDIR)/$(GDBINT)/libgdb/$(OS_TARGET)
+override GDBLIBDIR+=$(PACKAGESDIR)/$(GDBINT)/libgdb/$(OS_TARGET)
+override GDBOBJDIR+=$(PACKAGESDIR)/$(GDBINT)/libgdb/$(OS_TARGET)
 ifeq ($(OS_TARGET),go32v2)
 ifneq ($(DJDIR),)
-GDBLIBDIR+=$(DJDIR)/lib
+override GDBLIBDIR+=$(DJDIR)/lib
 endif
 endif
 ifeq ($(strip $(wildcard $(addsuffix /libgdb.a,$(GDBLIBDIR)))),)
@@ -69,7 +69,7 @@ endif
 
 
 [rules]
-.PHONY: gdb full fullgdb clean_compiler clean
+.PHONY: gdb full fullgdb clean_compiler clean testgdb postgdbinfo
 
 clean: fpc_cleanall
 
@@ -90,6 +90,8 @@ endif
 postgdbinfo:
 ifeq ($(GDBFOUND),0)
         $(ECHO) LibGDB was not found, IDE has no Debugger support
+else
+        $(ECHO) LibGDB found in $(LIBGDB)
 endif
 
 gdb:
@@ -124,4 +126,4 @@ install: fpc_install
 # Misc
 #
 clean_compiler:
-        $(MAKE) -C ../../compiler clean
+        $(MAKE) -C ../../compiler clean

+ 19 - 2
ide/text/fp.pas

@@ -30,6 +30,9 @@ uses
 {$ifdef go32v2}
   dpmiexcp,
 {$endif go32v2}
+{$ifdef fpc}
+  video,
+{$endif fpc}
   Dos,Objects,
   BrowCol,
   Drivers,Views,App,Dialogs,ColorSel,Menus,StdDlg,Validate,
@@ -101,6 +104,11 @@ begin
                  UseMouse:=false;
                  ButtonCount:=0;
                end;
+{$ifdef fpc}
+          'F' :
+             if Length(Param)=1 then
+               NoExtendedFrame:=true;
+{$endif fpc}
         end;
       end
     else
@@ -268,9 +276,18 @@ BEGIN
 END.
 {
   $Log$
-  Revision 1.3  2000-10-01 22:44:18  pierre
+  Revision 1.4  2000-11-13 17:37:41  pierre
+   merges from fixes branch
+
+  Revision 1.1.2.4  2000/11/09 08:53:35  pierre
+   + -F option to force use of only one graphic set
+
+  Revision 1.3  2000/10/01 22:44:18  pierre
    * remove lineinfo in _USES
 
+  Revision 1.1.2.3  2000/09/27 22:32:26  pierre
+   * suppress lineinfo explicit in _uses
+
   Revision 1.2  2000/08/22 09:41:39  pierre
    * first big merge from fixes branch
 
@@ -476,4 +493,4 @@ END.
     + Added symbol browser
     * splitted fp.pas to fpide.pas
 
-}
+}

+ 8 - 2
ide/text/fpcalc.pas

@@ -96,7 +96,7 @@ procedure RegisterFPCalc;
 
 implementation
 
-uses FPString,FPUtils,FPConst;
+uses FPString,FPUtils,FPConst,WUtils;
 
 const
   cmCalcButton  = 100;
@@ -463,7 +463,13 @@ end;
 end.
 {
   $Log$
-  Revision 1.1  2000-07-13 09:48:34  michael
+  Revision 1.2  2000-11-13 17:37:41  pierre
+   merges from fixes branch
+
+  Revision 1.1.2.1  2000/11/13 16:59:08  pierre
+   * some function in double removed from fputils unit
+
+  Revision 1.1  2000/07/13 09:48:34  michael
   + Initial import
 
   Revision 1.10  2000/05/02 08:42:26  pierre

+ 17 - 4
ide/text/fpcompil.pas

@@ -95,6 +95,7 @@ type
 const
     CompilerMessageWindow : PCompilerMessageWindow  = nil;
     CompilerStatusDialog  : PCompilerStatusDialog = nil;
+    CompileStamp          : longint = 0;
 
 procedure DoCompile(Mode: TCompileMode);
 function  NeedRecompile(verbose : boolean): boolean;
@@ -615,6 +616,8 @@ begin
     f:=new(PFPInputFile, Init(W^.Editor))
   else
     f:={$ifndef GABOR}def_openinputfile(filename){$else}nil{$endif};
+  if assigned(W) then
+    W^.Editor^.CompileStamp:=CompileStamp;
   CompilerOpenInputFile:=f;
 end;
 
@@ -805,6 +808,7 @@ begin
   JmpRet:=SetJmp(StopJmp);
   if JmpRet=0 then
     begin
+      inc(CompileStamp);
       FpIntF.Compile(FileName,SwitchesPath);
       SetStatus('Finished compiling...');
     end
@@ -964,6 +968,7 @@ var Need: boolean;
     I: sw_integer;
     SF: PSourceFile;
     SourceTime,PPUTime,ObjTime: longint;
+    W: PSourceWindow;
 begin
   if Assigned(SourceFiles)=false then
      Need:={(EditorModified=true)}true
@@ -992,10 +997,12 @@ begin
             writeln('O: ',SF^.GetObjFileName,' - ',ObjTime);
             writeln('------');}
             { some units don't generate object files }
+            W:=EditorWindowFile(SF^.GetSourceFileName);
             if (SourceTime<>-1) then
-              if (SourceTime>PPUTime) or
+              if ((SourceTime>PPUTime) or
                  ((SourceTime>ObjTime) and
-                 (ObjTime<>-1)) then
+                 (ObjTime<>-1))) or
+                 (assigned(W) and (W^.Editor^.CompileStamp<0)) then
                 begin
                   Need:=true;
                   if verbose then
@@ -1098,7 +1105,13 @@ end;
 end.
 {
   $Log$
-  Revision 1.5  2000-10-31 22:35:54  pierre
+  Revision 1.6  2000-11-13 17:37:41  pierre
+   merges from fixes branch
+
+  Revision 1.1.2.9  2000/11/06 16:55:48  pierre
+   * fix failure to recompile when file changed
+
+  Revision 1.5  2000/10/31 22:35:54  pierre
    * New big merge from fixes branch
 
   Revision 1.1.2.8  2000/10/31 07:51:58  pierre
@@ -1431,4 +1444,4 @@ end.
     + options are now written/read
     + find and replace routines
 
-}
+}

+ 9 - 3
ide/text/fpdebug.pas

@@ -458,7 +458,7 @@ const
 {$ifdef TP}
 function HexStr(Value: longint; Len: byte): string;
 begin
-  HexStr:=IntToHexL(Value,Len);
+  HexStr:=IntToHex(Value,Len);
 end;
 {$endif}
 
@@ -3374,7 +3374,13 @@ end.
 
 {
   $Log$
-  Revision 1.4  2000-10-31 22:35:54  pierre
+  Revision 1.5  2000-11-13 17:37:41  pierre
+   merges from fixes branch
+
+  Revision 1.1.2.8  2000/11/13 16:59:08  pierre
+   * some function in double removed from fputils unit
+
+  Revision 1.4  2000/10/31 22:35:54  pierre
    * New big merge from fixes branch
 
   Revision 1.1.2.7  2000/10/31 07:47:54  pierre
@@ -3699,4 +3705,4 @@ end.
   Revision 1.1  1999/01/22 10:24:03  peter
     * first debugger things
 
-}
+}

+ 9 - 3
ide/text/fpini.pas

@@ -151,7 +151,7 @@ begin
   C:='';
   for I:=1 to length(S) do
     begin
-      C:=C+'#$'+IntToHexL(ord(S[I]),2);
+      C:=C+'#$'+IntToHex(ord(S[I]),2);
     end;
   PaletteToStr:=C;
 end;
@@ -578,7 +578,13 @@ end;
 end.
 {
   $Log$
-  Revision 1.5  2000-10-31 22:35:54  pierre
+  Revision 1.6  2000-11-13 17:37:42  pierre
+   merges from fixes branch
+
+  Revision 1.1.2.5  2000/11/13 16:59:09  pierre
+   * some function in double removed from fputils unit
+
+  Revision 1.5  2000/10/31 22:35:54  pierre
    * New big merge from fixes branch
 
   Revision 1.4  2000/10/06 23:00:13  pierre
@@ -764,4 +770,4 @@ end.
     + Switches updated
     + Run program
 
-}
+}

+ 9 - 3
ide/text/fpintf.pas

@@ -35,7 +35,7 @@ uses
   FPDebug,
 {$endif NODEBUG}
   FPRedir,FPVars,
-  FPUtils,FPSwitch;
+  FPUtils,FPSwitch,WUtils;
 
 {****************************************************************************
                                    Run
@@ -212,7 +212,13 @@ end;
 end.
 {
   $Log$
-  Revision 1.1  2000-07-13 09:48:35  michael
+  Revision 1.2  2000-11-13 17:37:42  pierre
+   merges from fixes branch
+
+  Revision 1.1.2.1  2000/11/13 16:59:09  pierre
+   * some function in double removed from fputils unit
+
+  Revision 1.1  2000/07/13 09:48:35  michael
   + Initial import
 
   Revision 1.12  2000/06/22 09:07:12  pierre
@@ -269,4 +275,4 @@ end.
     + options are now written/read
     + find and replace routines
 
-}
+}

+ 26 - 4
ide/text/fpmtools.inc

@@ -153,7 +153,8 @@ var
   s : string;
   p,lineNb,GrepOutputLine : longint;
   error : word;
-  showmsg,error_in_reading : boolean;
+  PosText : longint;
+  showmsg,error_in_reading,FirstMsg : boolean;
   ToFocus : sw_integer;
   searchword,
   GrepExe,GrepArgs,Line,ModuleName : String;
@@ -222,6 +223,13 @@ begin
       if SearchWord<>'' then
        begin
          GrepArgs:=IL2^.Data^;
+         { Remember last used Grep extensions }
+         PosText:=pos('"$TEXT" ',GrepArgs);
+         if PosText>0 then
+           HighlightExts:=Trim(Copy(GrepArgs,PosText+Length('"$TEXT" '),Length(GrepArgs)));
+         { change spaces back into ';' again }
+         ReplaceStr(HighlightExts,' ',';');
+         { Replace search string }
          ReplaceStr(GrepArgs,'$TEXT',SearchWord);
          { Linux ? }
          AddToolCommand(GrepExe+' -n '+GrepArgs);
@@ -250,6 +258,7 @@ begin
          Assign(GrepOut,GrepOutName);
          Reset(GrepOut);
          error_in_reading:=false;
+         FirstMsg:=True;
          GrepOutputLine:=0;
          While not eof(GrepOut) do
            begin
@@ -263,7 +272,14 @@ begin
                  p:=pos(':',Line);
                  val(copy(Line,1,p-1),lineNb,error);
                  if error=0 then
-                   AddToolMessage(ModuleName,Copy(Line,p+1,255),LineNb,1)
+                   begin
+                     AddToolMessage(ModuleName,Copy(Line,p+1,255),LineNb,1);
+                     if FirstMsg then
+                       begin
+                         Inc(ToFocus);
+                         FirstMsg:=false;
+                       end;
+                   end
                  else
                    error_in_reading:=true;
                end;
@@ -300,7 +316,13 @@ end;
 
 {
   $Log$
-  Revision 1.2  2000-08-22 09:41:40  pierre
+  Revision 1.3  2000-11-13 17:37:42  pierre
+   merges from fixes branch
+
+  Revision 1.1.2.2  2000/11/13 16:57:04  pierre
+   * some grep improovements
+
+  Revision 1.2  2000/08/22 09:41:40  pierre
    * first big merge from fixes branch
 
   Revision 1.1.2.1  2000/07/20 11:02:15  michael
@@ -423,4 +445,4 @@ end;
     + options are now written/read
     + find and replace routines
 
-}
+}

+ 9 - 3
ide/text/fpsymbol.pas

@@ -961,7 +961,7 @@ function AddrStr(Addr: longint): string;
 type TLongint = record LoW,HiW: word; end;
 begin
   with TLongint(Addr) do
-  AddrStr:='$'+IntToHexL(HiW,4)+IntToHexL(HiW,4);
+  AddrStr:='$'+IntToHex(HiW,4)+IntToHex(HiW,4);
 end;
 begin
   ClearFormatParams;
@@ -1695,7 +1695,13 @@ end;
 END.
 {
   $Log$
-  Revision 1.2  2000-10-31 22:35:55  pierre
+  Revision 1.3  2000-11-13 17:37:42  pierre
+   merges from fixes branch
+
+  Revision 1.1.2.2  2000/11/13 16:59:09  pierre
+   * some function in double removed from fputils unit
+
+  Revision 1.2  2000/10/31 22:35:55  pierre
    * New big merge from fixes branch
 
   Revision 1.1.2.1  2000/09/27 21:06:11  pierre
@@ -1824,4 +1830,4 @@ END.
 
   Revision 1.0  1999/01/09 11:49:41  gabor
      Original implementation
-}
+}

+ 11 - 144
ide/text/fputils.pas

@@ -34,29 +34,14 @@ const
   ppext  = '.pp';
 {$endif}
 
-function IntToStr(L: longint): string;
-function IntToStrZ(L: longint; MinLen: byte): string;
-function IntToStrL(L: longint; MinLen: byte): string;
-function StrToInt(const S: string): longint;
-function IntToHex(L: longint): string;
-function IntToHexL(L: longint; MinLen: byte): string;
-function HexToInt(S: string): longint;
 function SmartPath(Path: string): string;
 Function FixPath(s:string;allowdot:boolean):string;
 function FixFileName(const s:string):string;
 function MakeExeName(const fn:string):string;
-function LExpand(const S: string; MinLen: byte): string;
-function RExpand(const S: string; MinLen: byte): string;
 function Center(const S: string; Len: byte): string;
 function FitStr(const S: string; Len: byte): string;
-function LTrim(const S: string): string;
-function RTrim(const S: string): string;
-function Trim(const S: string): string;
 function KillTilde(S: string): string;
-function UpcaseStr(const S: string): string;
 function LowercaseStr(const S: string): string;
-function Max(A,B: longint): longint;
-function Min(A,B: longint): longint;
 function DirOf(const S: string): string;
 function ExtOf(const S: string): string;
 function NameOf(const S: string): string;
@@ -76,9 +61,7 @@ function GetStr(const P: PString): string;
 procedure ReplaceStr(var S: string; const What,NewS: string);
 procedure ReplaceStrI(var S: string; What: string; const NewS: string);
 
-const LastStrToIntResult : integer = 0;
-      LastHexToIntResult : integer = 0;
-      ListSeparator      : char = ';';
+const ListSeparator      : char = ';';
 
 implementation
 
@@ -93,16 +76,6 @@ begin
   IntToStr:=S;
 end;
 
-function StrToInt(const S: string): longint;
-var L: longint;
-    C: integer;
-begin
-  Val(S,L,C);
-  if C<>0 then L:=-1;
-  LastStrToIntResult:=C;
-  StrToInt:=L;
-end;
-
 function IntToStrZ(L: longint; MinLen: byte): string;
 var S: string;
 begin
@@ -188,24 +161,6 @@ begin
 end;
 
 
-function LExpand(const S: string; MinLen: byte): string;
-begin
-  if length(S)<MinLen then
-    LExpand:=CharStr(' ',MinLen-length(S))+S
-  else
-    LExpand:=S;
-end;
-
-
-function RExpand(const S: string; MinLen: byte): string;
-begin
-  if length(S)<MinLen then
-    RExpand:=S+CharStr(' ',MinLen-length(S))
-  else
-    RExpand:=S;
-end;
-
-
 function Center(const S: string; Len: byte): string;
 begin
   Center:=LExpand(S+CharStr(' ',Max(0,(Len-length(S)) div 2)),Len);
@@ -228,18 +183,6 @@ begin
   KillTilde:=S;
 end;
 
-function UpcaseStr(const S: string): string;
-var
-  I: Longint;
-begin
-  for I:=1 to length(S) do
-    if S[I] in ['a'..'z'] then
-      UpCaseStr[I]:=chr(ord(S[I])-32)
-    else
-      UpCaseStr[I]:=S[I];
-  UpcaseStr[0]:=S[0];
-end;
-
 function LowerCaseStr(const S: string): string;
 var
   I: Longint;
@@ -252,16 +195,6 @@ begin
   LowercaseStr[0]:=S[0];
 end;
 
-function Max(A,B: longint): longint;
-begin
-  if A>B then Max:=A else Max:=B;
-end;
-
-function Min(A,B: longint): longint;
-begin
-  if A<B then Min:=A else Min:=B;
-end;
-
 function DirOf(const S: string): string;
 var D: DirStr; E: ExtStr; N: NameStr;
 begin
@@ -309,79 +242,6 @@ begin
          else Power:=exp(B*ln(A));
 end;
 
-function IntToHex(L: longint): string;
-const HexNums : string[16] = '0123456789ABCDEF';
-var S: string;
-    R: real;
-function DivF(Mit,Mivel: real): longint;
-begin
-  DivF:=trunc(Mit/Mivel);
-end;
-function ModF(Mit,Mivel: real): longint;
-begin
-  ModF:=trunc(Mit-DivF(Mit,Mivel)*Mivel);
-end;
-begin
-  S:='';
-  R:=L; if R<0 then begin R:=R+2147483647+2147483647+2; end;
-  repeat
-    S:=HexNums[ModF(R,16)+1]+S;
-    R:=DivF(R,16);
-  until R=0;
-  IntToHex:=S;
-end;
-
-function HexToInt(S: string): longint;
-var L,I: longint;
-    C: char;
-const HexNums: string[16] = '0123456789ABCDEF';
-begin
-  S:=Trim(S); L:=0; I:=1; LastHexToIntResult:=0;
-  while (I<=length(S)) and (LastHexToIntResult=0) do
-  begin
-    C:=Upcase(S[I]);
-    if C in['0'..'9','A'..'F'] then
-    begin
-      L:=L*16+(Pos(C,HexNums)-1);
-    end else LastHexToIntResult:=I;
-    Inc(I);
-  end;
-  HexToInt:=L;
-end;
-
-function IntToHexL(L: longint; MinLen: byte): string;
-var S: string;
-begin
-  S:=IntToHex(L);
-  while length(S)<MinLen do S:='0'+S;
-  IntToHexL:=S;
-end;
-
-function LTrim(const S: string): string;
-var
-  i : longint;
-begin
-  i:=1;
-  while (i<length(s)) and (s[i]=' ') do
-   inc(i);
-  LTrim:=Copy(s,i,High(S));
-end;
-
-function RTrim(const S: string): string;
-var
-  i : longint;
-begin
-  i:=length(s);
-  while (i>0) and (s[i]=' ') do
-   dec(i);
-  RTrim:=Copy(s,1,i);
-end;
-
-function Trim(const S: string): string;
-begin
-  Trim:=RTrim(LTrim(S));
-end;
-
 function MatchesMask(What, Mask: string): boolean;
 
   function upper(const s : string) : string;
@@ -459,7 +319,8 @@ begin
   if What<>'' then
   repeat
     P:=Pos(ListSeparator, MaskList);
-    if P=0 then P:=length(MaskList)+1;
+    if P=0 then
+      P:=length(MaskList)+1;
     Match:=MatchesMask(What,copy(MaskList,1,P-1));
     Delete(MaskList,1,P);
   until Match or (MaskList='');
@@ -632,7 +493,13 @@ end;
 END.
 {
   $Log$
-  Revision 1.3  2000-11-03 16:05:38  pierre
+  Revision 1.4  2000-11-13 17:37:42  pierre
+   merges from fixes branch
+
+  Revision 1.1.2.4  2000/11/13 16:59:09  pierre
+   * some function in double removed from fputils unit
+
+  Revision 1.3  2000/11/03 16:05:38  pierre
    * (merged)
 
   Revision 1.1.2.3  2000/11/03 15:45:57  pierre
@@ -750,4 +617,4 @@ END.
     + options are now written/read
     + find and replace routines
 
-}
+}

+ 17 - 3
ide/text/fpviews.pas

@@ -127,6 +127,7 @@ type
     TSourceEditor = object(TFileEditor)
       constructor Init(var Bounds: TRect; AHScrollBar, AVScrollBar:
           PScrollBar; AIndicator: PIndicator;const AFileName: string);
+      CompileStamp : longint;
 {$ifndef EDITORS}
     public
       CodeCompleteTip: PFPToolTip;
@@ -893,6 +894,7 @@ begin
   EC:=SearchCoreForFileName(AFileName);
   inherited Init(Bounds,AHScrollBar,AVScrollBar,AIndicator,EC,AFileName);
   SetStoreUndo(true);
+  CompileStamp:=0;
 end;
 
 function TSourceEditor.GetSpecSymbolCount(SpecClass: TSpecSymbolClass): integer;
@@ -1024,7 +1026,13 @@ procedure TSourceEditor.ModifiedChanged;
 begin
   inherited ModifiedChanged;
   if (@Self<>Clipboard) and GetModified then
-    EditorModified:=true;
+    begin
+      { global flags }
+      EditorModified:=true;
+      { reset compile flags as the file is
+      not the same as at the compilation anymore }
+      CompileStamp:=-1;
+    end;
 end;
 
 procedure TSourceEditor.InsertOptions;
@@ -3564,7 +3572,13 @@ end;
 END.
 {
   $Log$
-  Revision 1.3  2000-10-31 22:35:55  pierre
+  Revision 1.4  2000-11-13 17:37:42  pierre
+   merges from fixes branch
+
+  Revision 1.1.2.13  2000/11/06 16:55:48  pierre
+   * fix failure to recompile when file changed
+
+  Revision 1.3  2000/10/31 22:35:55  pierre
    * New big merge from fixes branch
 
   Revision 1.1.2.12  2000/10/31 07:54:24  pierre
@@ -3965,4 +3979,4 @@ END.
     + options are now written/read
     + find and replace routines
 
-}
+}

+ 29 - 23
ide/text/weditor.pas

@@ -919,16 +919,6 @@ begin
   ExistsFile:=Exists;
 end;
 
-function Max(A,B: longint): longint;
-begin
-  if A>B then Max:=A else Max:=B;
-end;
-
-function Min(A,B: longint): longint;
-begin
-  if A<B then Min:=A else Min:=B;
-end;
-
 function StrToInt(const S: string): longint;
 var L: longint;
     C: integer;
@@ -4929,6 +4919,7 @@ begin
   S:='';
   { If AutoIndent try to align first line to
     last line before selection }
+  { DISABLED created problems PM
   if IsFlagSet(efAutoIndent) and (SelStart.Y>0) then
     begin
       i:=SelStart.Y-1;
@@ -4955,7 +4946,7 @@ begin
           Ind:=CharStr(' ',indlen);
         end;
     end
-  else
+  else }
    Ind:=' ';
   for i:=selstart.y to ey do
    begin
@@ -4989,6 +4980,7 @@ begin
    dec(ey);
   { If AutoIndent try to align first line to
     last line before selection }
+  { Disabled created problems
   if IsFlagSet(efAutoIndent) and (SelStart.Y>0) then
     begin
       S:=GetDisplayText(SelStart.Y);
@@ -5018,7 +5010,7 @@ begin
             indlen:=1;
         end;
     end
-  else
+  else }
    Indlen:=1;
   for i:=selstart.y to ey do
    begin
@@ -6126,7 +6118,7 @@ end;
 
 function TCustomCodeEditorCore.LoadFromStream(Editor: PCustomCodeEditor; Stream: PStream): boolean;
 var S: string;
-    AllLinesComplete,LineComplete,OK: boolean;
+    AllLinesComplete,LineComplete,hasCR,OK: boolean;
 begin
   DeleteAllLines;
   ChangedLine:=-1;
@@ -6135,15 +6127,20 @@ begin
   if eofstream(Stream) then
    AddLine('')
   else
-   while OK and (eofstream(Stream)=false) and (GetLineCount<MaxLineCount) do
    begin
-     ReadlnFromStream(Stream,S,LineComplete);
-     AllLinesComplete:=AllLinesComplete and LineComplete;
-     OK:=OK and (Stream^.Status=stOK);
-     if OK then AddLine(S);
-     if not LineComplete and (ChangedLine=-1) then
-       ChangedLine:=GetLineCount;
-   end;
+     while OK and (eofstream(Stream)=false) and (GetLineCount<MaxLineCount) do
+       begin
+         ReadlnFromStream(Stream,S,LineComplete,hasCR);
+         AllLinesComplete:=AllLinesComplete and LineComplete;
+         OK:=OK and (Stream^.Status=stOK);
+         if OK then AddLine(S);
+         if not LineComplete and (ChangedLine=-1) then
+           ChangedLine:=GetLineCount;
+       end;
+     { Do not remove the final newline if it exists PM }
+     if hasCR then
+       AddLine('');
+    end;
   LimitsChanged;
   if not AllLinesComplete then
     SetModified(true);
@@ -6574,7 +6571,16 @@ end;
 END.
 {
   $Log$
-  Revision 1.4  2000-11-03 16:05:38  pierre
+  Revision 1.5  2000-11-13 17:37:42  pierre
+   merges from fixes branch
+
+  Revision 1.1.2.15  2000/11/13 16:55:09  pierre
+   * multi space indent disabled
+
+  Revision 1.1.2.14  2000/11/06 17:19:58  pierre
+   * avoid eating of last carriage return
+
+  Revision 1.4  2000/11/03 16:05:38  pierre
    * (merged)
 
   Revision 1.1.2.13  2000/11/03 15:49:26  pierre
@@ -7040,4 +7046,4 @@ END.
     + options are now written/read
     + find and replace routines
 
-}
+}

+ 5 - 2
ide/text/whelp.pas

@@ -1308,7 +1308,10 @@ end;
 END.
 {
   $Log$
-  Revision 1.3  2000-11-11 23:05:31  hajny
+  Revision 1.4  2000-11-13 17:37:43  pierre
+   merges from fixes branch
+
+  Revision 1.3  2000/11/11 23:05:31  hajny
     * OS/2 implementation of GetDosTicks added
 
   Revision 1.2  2000/10/31 22:35:56  pierre
@@ -1443,4 +1446,4 @@ END.
     + options are now written/read
     + find and replace routines
 
-}
+}

+ 39 - 5
ide/text/wutils.pas

@@ -107,7 +107,7 @@ type
   procedure readln(var t:text;var s:string);
 {$endif}
 
-procedure ReadlnFromStream(Stream: PStream; var s:string;var linecomplete : boolean);
+procedure ReadlnFromStream(Stream: PStream; var s:string;var linecomplete,hasCR : boolean);
 function eofstream(s: pstream): boolean;
 
 function Min(A,B: longint): longint;
@@ -126,6 +126,7 @@ function IntToStr(L: longint): string;
 function IntToStrL(L: longint; MinLen: sw_integer): string;
 function IntToStrZ(L: longint; MinLen: sw_integer): string;
 function StrToInt(const S: string): longint;
+function HexToInt(S: string): longint;
 function IntToHex(L: longint; MinLen: integer): string;
 function GetStr(P: PString): string;
 function GetPChar(P: PChar): string;
@@ -172,6 +173,7 @@ procedure StrToMem(S: string; var B);
 procedure GiveUpTimeSlice;
 
 const LastStrToIntResult : integer = 0;
+      LastHexToIntResult : integer = 0;
       DirSep             : char    = {$ifdef Linux}'/'{$else}'\'{$endif};
 
 procedure RegisterWUtils;
@@ -230,7 +232,7 @@ begin
   eofstream:=(s^.getpos>=s^.getsize);
 end;
 
-procedure ReadlnFromStream(Stream: PStream; var S:string;var linecomplete : boolean);
+procedure ReadlnFromStream(Stream: PStream; var S:string;var linecomplete,hasCR : boolean);
   var
     c : char;
     i,pos : longint;
@@ -269,6 +271,8 @@ procedure ReadlnFromStream(Stream: PStream; var S:string;var linecomplete : bool
       end;
     if (c=#10) or eofstream(stream) then
       linecomplete:=true;
+    if (c=#10) then
+      hasCR:=true;
     s[0]:=chr(i);
   end;
 
@@ -411,6 +415,25 @@ begin
   StrToInt:=L;
 end;
 
+function HexToInt(S: string): longint;
+var L,I: longint;
+    C: char;
+const HexNums: string[16] = '0123456789ABCDEF';
+begin
+  S:=Trim(S); L:=0; I:=1; LastHexToIntResult:=0;
+  while (I<=length(S)) and (LastHexToIntResult=0) do
+  begin
+    C:=Upcase(S[I]);
+    if C in['0'..'9','A'..'F'] then
+    begin
+      L:=L*16+(Pos(C,HexNums)-1);
+    end else LastHexToIntResult:=I;
+    Inc(I);
+  end;
+  HexToInt:=L;
+end;
+
+
 function IntToHex(L: longint; MinLen: integer): string;
 const HexNums : string[16] = '0123456789ABCDEF';
 var S: string;
@@ -434,7 +457,6 @@ begin
   IntToHex:=S;
 end;
 
-
 function GetStr(P: PString): string;
 begin
   if P=nil then GetStr:='' else GetStr:=P^;
@@ -1161,7 +1183,19 @@ BEGIN
 END.
 {
   $Log$
-  Revision 1.6  2000-11-04 20:04:33  hajny
+  Revision 1.7  2000-11-13 17:37:44  pierre
+   merges from fixes branch
+
+  Revision 1.1.2.9  2000/11/13 16:59:10  pierre
+   * some function in double removed from fputils unit
+
+  Revision 1.1.2.8  2000/11/12 19:50:36  hajny
+    * OS/2 changes from the main branch merged
+
+  Revision 1.1.2.7  2000/11/06 17:19:58  pierre
+   * avoid eating of last carriage return
+
+  Revision 1.6  2000/11/04 20:04:33  hajny
     * wrong DosError was used under OS/2
 
   Revision 1.5  2000/10/31 22:35:56  pierre
@@ -1300,4 +1334,4 @@ END.
   Revision 1.1  1999/03/01 15:51:43  peter
     + Log
 
-}
+}