Skip to content

Commit

Permalink
Merge pull request #160 from royqh1979/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
royqh1979 authored Mar 18, 2021
2 parents 881b615 + d38dc39 commit 398286d
Show file tree
Hide file tree
Showing 29 changed files with 460 additions and 358 deletions.
2 changes: 2 additions & 0 deletions Lang/Chinese.lng
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@ Ver=1
10030=���öϵ�����...
10031=ɾ���ϵ�
10032=�رձ������[&C]
10033=������жϵ�
10034=�����ǰ�ļ������жϵ�


11001=�Ƴ��ļ�
Expand Down
2 changes: 2 additions & 0 deletions Lang/English.lng
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@ Ver=1
10030=Breakpoint condition...
10031=Remove Breakpoint
10032=&Close Report Panel
10033=Clear All breakpoints
10034=Clear All breakpoints in the editor


11001=Remove File
Expand Down
8 changes: 8 additions & 0 deletions NEWS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ Version 6.6.1 MAR 2021
- fix: function parameters parse error is seperated by ', '
- enhancement: auto save all project files after it was created
- enhancement: double click on the file editor's title bar will trigger full screen
- fix: can't correctly compile Tools/CheckLang project
- enhancement: hide special chars in selected contents
- enhancement: correctly color special characters in comments/preprocessors/strings
- enhancement: add clear breakpoints menuitem in editor's context menu
- enhancement: add clear all breakpoints menuitem in breakpoints view's context menu
- enhancement: use standalone checker instead of compiler to check syntax
- fix: when using IME to append contents to the end of a line, a space char will be wrongly added
- fix: border around current placeholder not correctly cleared when switch to the next placeholder which is not in the same line

Version 6.6 MAR 2021

Expand Down
24 changes: 13 additions & 11 deletions Source/Compiler.pas
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ procedure TCompiler.WriteMakeTarget(var F: TextFile);
Writeln(F);
if fProject.Options.UsePrecompiledHeader then begin
Writeln(F, '$(PCH) : $(PCH_H)');
Writeln(F, ' $(CPP) -x c++-header $(PCH_H) -o $(PCH) $(CXXFLAGS)');
Writeln(F, ' $(CPP) -x c++-header "$(PCH_H)" -o "$(PCH)" $(CXXFLAGS)');
Writeln(F);
end;
end;
Expand Down Expand Up @@ -470,9 +470,9 @@ procedure TCompiler.WriteMakeObjFilesRules(var F: TextFile);
Writeln(F, #9 + '$(CC) -c ' + GenMakePath1(ShortFileName) + ' $(CFLAGS) '+encodingStr);
end else begin
if fProject.Units[i].CompileCpp then
Writeln(F, #9 + '$(CPP) -c ' + GenMakePath1(ShortFileName) + ' -o ' + ObjFileName + ' $(CXXFLAGS) ' + encodingStr)
Writeln(F, #9 + '$(CPP) -c ' + GenMakePath1(ShortFileName) + ' -o "' + ObjFileName + '" $(CXXFLAGS) ' + encodingStr)
else
Writeln(F, #9 + '$(CC) -c ' + GenMakePath1(ShortFileName) + ' -o ' + ObjFileName + ' $(CFLAGS) ' + encodingStr);
Writeln(F, #9 + '$(CC) -c ' + GenMakePath1(ShortFileName) + ' -o "' + ObjFileName + '" $(CFLAGS) ' + encodingStr);
end;
end;
end;
Expand Down Expand Up @@ -550,9 +550,9 @@ procedure TCompiler.CreateStandardMakefile;
Writeln(F, '$(BIN): $(OBJ)');
if not fCheckSyntax then
if fProject.Options.useGPP then
Writeln(F, #9 + '$(CPP) $(LINKOBJ) -o $(BIN) $(LIBS)')
Writeln(F, #9 + '$(CPP) $(LINKOBJ) -o "$(BIN)" $(LIBS)')
else
Writeln(F, #9 + '$(CC) $(LINKOBJ) -o $(BIN) $(LIBS)');
Writeln(F, #9 + '$(CC) $(LINKOBJ) -o "$(BIN)" $(LIBS)');
WriteMakeObjFilesRules(F);
finally
CloseFile(F);
Expand Down Expand Up @@ -586,10 +586,10 @@ procedure TCompiler.CreateDynamicMakeFile;
if not fCheckSyntax then begin
if fProject.Options.useGPP then
Writeln(F, #9 +
'$(CPP) -shared $(LINKOBJ) -o $(BIN) $(LIBS) -Wl,--output-def,$(DEF),--out-implib,$(STATIC),--add-stdcall-alias')
'$(CPP) -shared $(LINKOBJ) -o "$(BIN)" $(LIBS) -Wl,--output-def,$(DEF),--out-implib,$(STATIC),--add-stdcall-alias')
else
Writeln(F, #9 +
'$(CC) -shared $(LINKOBJ) -o $(BIN) $(LIBS) -Wl,--output-def,$(DEF),--out-implib,$(STATIC),--add-stdcall-alias')
'$(CC) -shared $(LINKOBJ) -o "$(BIN)" $(LIBS) -Wl,--output-def,$(DEF),--out-implib,$(STATIC),--add-stdcall-alias')
end;
WriteMakeObjFilesRules(F);
finally
Expand Down Expand Up @@ -874,7 +874,8 @@ procedure TCompiler.RunTerminate(Sender: TObject);
begin
Application.Restore;

OnRunEnd;
if Assigned(fOnRunEnd) then
fOnRunEnd;

MainForm.UpdateAppTitle;
end;
Expand Down Expand Up @@ -1146,16 +1147,17 @@ procedure TCompiler.AbortThread;

procedure TCompiler.OnCompilationTerminated(Sender: TObject);
begin
OnCompEnd;
if Assigned(fOnCompEnd) then
fOnCompEnd;

fDevRun := nil;

MainForm.UpdateAppTitle;

EndProgressForm;

if (fErrCount = 0) and not fAbortThread then
OnCompSuccess;
if (fErrCount = 0) and not fAbortThread and Assigned(fOnCompSuccess) then
fOnCompSuccess;
end;

procedure TCompiler.OnLineOutput(Sender: TObject; const Line: AnsiString);
Expand Down
26 changes: 12 additions & 14 deletions Source/Debugger.pas
Original file line number Diff line number Diff line change
Expand Up @@ -312,9 +312,14 @@ procedure TDebugger.RemoveBreakPoint(i: integer);
var
filename: AnsiString;
begin
// "filename":linenum
filename := StringReplace(PBreakPoint(BreakPointList.Items[i])^.editor.FileName, '\', '/', [rfReplaceAll]);
SendCommand('clear', '"' + filename + '":' + inttostr(PBreakPoint(BreakPointList.Items[i])^.line));
// Debugger already running? Remove it from GDB
if Executing then begin
// "filename":linenum
filename := StringReplace(PBreakPoint(BreakPointList.Items[i])^.editor.FileName, '\', '/', [rfReplaceAll]);
SendCommand('clear', '"' + filename + '":' + inttostr(PBreakPoint(BreakPointList.Items[i])^.line));
end;
Dispose(PBreakPoint(BreakPointList.Items[i]));
BreakPointList.Delete(i);
end;

procedure TDebugger.AddBreakPoint(linein: integer; e: TEditor);
Expand All @@ -340,20 +345,13 @@ procedure TDebugger.RemoveBreakPoint(Linein: integer; e: TEditor);
i: integer;
begin
for i := 0 to BreakPointList.Count - 1 do begin
if (PBreakPoint(BreakPointList.Items[i])^.line = Linein) and (PBreakPoint(BreakPointList.Items[i])^.editor = e) then
begin

// Debugger already running? Remove it from GDB
if Executing then
RemoveBreakPoint(i);

// Remove from list
Dispose(PBreakPoint(BreakPointList.Items[i]));
BreakPointList.Delete(i);
if (PBreakPoint(BreakPointList.Items[i])^.line = Linein)
and (PBreakPoint(BreakPointList.Items[i])^.editor = e) then begin
RemoveBreakPoint(i);
MainForm.OnBreakPointsChanged;
break;
end;
end;
MainForm.OnBreakPointsChanged;
end;

function TDebugger.GetBreakPointIndexOnLine(lineNo:integer; e: TEditor):Integer;
Expand Down
32 changes: 19 additions & 13 deletions Source/Editor.pas
Original file line number Diff line number Diff line change
Expand Up @@ -1580,6 +1580,7 @@ procedure TEditor.HandleSymbolCompletion(var Key: Char);
status : TQuoteStates;
tokenFinished: boolean;
HighlightPos : TBufferCoord;
tokenType : TSynHighlighterTokenType;

function GetCurrentChar:AnsiChar;
begin
Expand Down Expand Up @@ -1860,15 +1861,14 @@ procedure TEditor.HandleSymbolCompletion(var Key: Char);
HighlightPos := BufferCoord(fText.CaretX-1, fText.CaretY);

// Check if that line is highlighted as comment
if fText.GetHighlighterAttriAtRowCol(HighlightPos, Token, tokenFinished,Attr) then begin
if (Attr = fText.Highlighter.CommentAttribute) and not tokenFinished then
if fText.GetHighlighterAttriAtRowCol(HighlightPos, Token, tokenFinished, tokenType,Attr) then begin
if (tokenType = httComment) and not tokenFinished then
Exit;
if ((Attr = fText.Highlighter.StringAttribute)
or SameStr(Attr.Name,'Character') or (Attr = dmMain.Cpp.StringEscapeSeqAttri) )
if (tokenType = httString)
and not tokenFinished
and not (key in ['''','"','(',')']) then
Exit;
if (key in ['<','>']) and (Attr<> dmMain.Cpp.DirecAttri) then begin
if (key in ['<','>']) and (tokenType <> httPreprocessDirective) then begin
Exit;
end;
if (key = '''') and (Attr = dmMain.Cpp.NumberAttri) then begin
Expand Down Expand Up @@ -2076,39 +2076,41 @@ procedure TEditor.EditorKeyDown(Sender: TObject; var Key: Word; Shift: TShiftSta
funcName:AnsiString;
isVoid : boolean;
i:integer;
oldLine:integer;

procedure UndoSymbolCompletion;
var
Attr: TSynHighlighterAttributes;
Token: AnsiString;
tokenFinished: boolean;
tokenType: TSynHighlighterTokenType;
HighlightPos : TBufferCoord;
begin
if devEditor.DeleteSymbolPairs then begin
HighlightPos := BufferCoord(fText.CaretX, fText.CaretY);

// Check if that line is highlighted as comment
if not fText.GetHighlighterAttriAtRowCol(HighlightPos, Token, tokenFinished,Attr) then
if not fText.GetHighlighterAttriAtRowCol(HighlightPos, Token, tokenFinished, tokenType, Attr) then
Exit;
if (Attr = fText.Highlighter.CommentAttribute) and not tokenFinished then
if (tokenType = httComment) and not tokenFinished then
Exit;
if SameStr(Attr.Name,'Character') and not (DeletedChar = '''') then
if (tokenType = httCharacter) and not (DeletedChar = '''') then
Exit;
if (Attr = dmMain.Cpp.StringEscapeSeqAttri) then
if (tokenType = httStringEscapeSequence) then
Exit;
if (Attr = fText.Highlighter.StringAttribute) then begin
if (tokenType = httString) then begin
if not (DeletedChar in ['"','(']) then
Exit;
if (DeletedChar = '"') and not SameStr(Token,'""') then
Exit;
if (DeletedChar = '(') and not StartsStr('R"',Token) then
Exit;
end;
if (DeletedChar = '''') and (Attr = dmMain.Cpp.NumberAttri) then begin
if (DeletedChar = '''') and (tokenType = httNumber) then begin
Exit;
end;
if (DeletedChar = '<') and
((Attr<> dmMain.Cpp.DirecAttri) or not StartsStr('#include',fText.LineText)) then begin
((tokenType <> httPreprocessDirective) or not StartsStr('#include',fText.LineText)) then begin
Exit;
end;
if (devEditor.ArrayComplete and (DeletedChar = '[') and (NextChar = ']')) or
Expand Down Expand Up @@ -2211,7 +2213,10 @@ procedure TEditor.EditorKeyDown(Sender: TObject; var Key: Word; Shift: TShiftSta
VK_TAB: begin
if fUserCodeInTabStops.Count > 0 then begin
Key:=0;
oldLine := fText.CaretY;
PopUserCodeInTabStops;
if oldLine <> fText.CaretY then
fText.InvalidateLine(oldLine);
fText.InvalidateLine(fText.CaretY);
end else begin
if fTabStopBegin >= 0 then begin
Expand Down Expand Up @@ -3724,7 +3729,8 @@ procedure TEditor.AddSyntaxError(line:integer; col:integer; errorType:TSyntaxErr
p:TBufferCoord;
p1:TDisplayCoord;
token:String;
tokenType,start:integer;
tokenType : TSynHighlighterTokenType;
start:integer;
Attri: TSynHighlighterAttributes;
idx:integer;
lst:TList;
Expand Down
21 changes: 11 additions & 10 deletions Source/LangIDs.inc
Original file line number Diff line number Diff line change
Expand Up @@ -221,17 +221,18 @@ const
ID_POP_EDITRES = 10020;
ID_ITEM_NEXTINS = 10021;
ID_ITEM_STEPINS = 10022;
ID_ITEM_STEPOUT = 10023;
ID_ITEM_STEPOUT = 10023;
ID_ITEM_GOTOBREAKPOINT = 10024;
ID_ITEM_CALLSTACK = 10025;
ID_ITEM_LOCALS = 10026;
ID_ITEM_GLOBALS = 10027;
ID_ITEM_ARGS = 10028;
ID_ITEM_CALLSTACKFULL = 10029;
ID_ITEM_BREAKPOINT_PROP = 10030;
ID_ITEM_REMOVE_BREAKPOINT = 10031;
ID_ITEM_CLOSEMESSAGE_SHEET =10032;

ID_ITEM_CALLSTACK = 10025;
ID_ITEM_LOCALS = 10026;
ID_ITEM_GLOBALS = 10027;
ID_ITEM_ARGS = 10028;
ID_ITEM_CALLSTACKFULL = 10029;
ID_ITEM_BREAKPOINT_PROP = 10030;
ID_ITEM_REMOVE_BREAKPOINT = 10031;
ID_ITEM_CLOSEMESSAGE_SHEET = 10032;
ID_ITEM_CLEAR_ALL_BREAKPOINTS = 10033;
ID_ITEM_CLEAR_ALL_BREAKPOINTS_IN_FILE = 10034;

// unit popup
ID_POP_REMOVE = 11001;
Expand Down
6 changes: 3 additions & 3 deletions Source/ProjectOptionsFrm.dfm
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ object ProjectOptionsFrm: TProjectOptionsFrm
Width = 164
Height = 28
Style = csDropDownList
ItemHeight = 20
ItemHeight = 0
TabOrder = 6
OnChange = cbEncodingChange
end
Expand Down Expand Up @@ -506,7 +506,7 @@ object ProjectOptionsFrm: TProjectOptionsFrm
Width = 660
Height = 28
Style = csDropDownList
ItemHeight = 20
ItemHeight = 0
TabOrder = 1
OnChange = cmbCompilerChange
end
Expand Down Expand Up @@ -1500,7 +1500,7 @@ object ProjectOptionsFrm: TProjectOptionsFrm
Width = 279
Height = 28
Style = csDropDownList
ItemHeight = 20
ItemHeight = 0
Sorted = True
TabOrder = 4
end
Expand Down
4 changes: 2 additions & 2 deletions Source/ProjectOptionsFrm.pas
Original file line number Diff line number Diff line change
Expand Up @@ -1144,9 +1144,9 @@ function TProjectOptionsFrm.DefaultBuildCommand(idx: integer): AnsiString;
end else
ofile := GenMakePath1(ChangeFileExt(tfile, OBJ_EXT));
if fProjectCopy.Units[idx].CompileCpp then
Result := '$(CPP) -c ' + GenMakePath1(tfile) + ' -o ' + ofile + ' $(CXXFLAGS)'
Result := '$(CPP) -c ' + GenMakePath1(tfile) + ' -o "' + ofile + '" $(CXXFLAGS)'
else
Result := '$(CC) -c ' + GenMakePath1(tfile) + ' -o ' + ofile + ' $(CFLAGS)';
Result := '$(CC) -c ' + GenMakePath1(tfile) + ' -o "' + ofile + '" $(CFLAGS)';
end;

procedure TProjectOptionsFrm.txtOverrideBuildCmdChange(Sender: TObject);
Expand Down
Loading

0 comments on commit 398286d

Please sign in to comment.