From e0e9cbac8f73d3abc41114ece913bb02cb632ac5 Mon Sep 17 00:00:00 2001 From: Basile Burg Date: Sun, 31 Jan 2016 12:13:48 +0100 Subject: [PATCH] more refact using helpers --- src/ce_common.pas | 37 ++++++++++++++++++++----------------- src/ce_dcd.pas | 10 +++++----- src/ce_dfmt.pas | 2 +- src/ce_dubproject.pas | 2 +- src/ce_editor.pas | 2 +- src/ce_editoroptions.pas | 8 ++++---- src/ce_gdb.pas | 4 ++-- src/ce_libman.pas | 4 ++-- src/ce_main.pas | 8 ++++---- src/ce_messages.pas | 16 ++++++++-------- src/ce_miniexplorer.pas | 8 ++++---- src/ce_nativeproject.pas | 4 ++-- src/ce_optionseditor.pas | 2 +- src/ce_procinput.pas | 2 +- src/ce_search.pas | 8 ++++---- src/ce_shortcutseditor.lfm | 2 ++ src/ce_shortcutseditor.pas | 2 +- src/ce_staticmacro.pas | 4 ++-- src/ce_symlist.pas | 2 +- src/ce_symstring.pas | 3 +-- src/ce_synmemo.pas | 26 +++++++++++++------------- src/ce_tools.pas | 6 +++--- wiki/wiki.txt | 13 +++++++------ 23 files changed, 90 insertions(+), 85 deletions(-) diff --git a/src/ce_common.pas b/src/ce_common.pas index d6ed0005..a04fa1b8 100644 --- a/src/ce_common.pas +++ b/src/ce_common.pas @@ -28,9 +28,6 @@ type TCECompiler = (dmd, gdc, ldc); - -type - // aliased to get a custom prop inspector TCEPathname = type string; TCEFilename = type string; @@ -58,6 +55,7 @@ type function fileExists: boolean; function dirExists: boolean; function upperCase: string; + function length: integer; end; (** @@ -368,6 +366,11 @@ begin exit(sysutils.upperCase(self)); end; +function TStringHelper.length: integer; +begin + exit(system.length(self)); +end; + {$IFDEF LINUX} constructor TCheckedAsyncProcess.Create(aOwner: TComponent); begin @@ -495,8 +498,8 @@ var dir: string; begin dir := ExtractFileDrive(src); - if length(dir) > 0 then - result := src[length(dir)+1..length(src)] + if dir.length > 0 then + result := src[dir.length+1..src.length] else result := src; i := pos(invalid, result); @@ -595,20 +598,20 @@ var drv: string; pth1: string; begin - if length(aPath) <= charThresh then + if aPath.length <= charThresh then exit(aPath); drv := extractFileDrive(aPath); - i := length(aPath); - while(i <> length(drv)+1) do + i := aPath.length; + while(i <> drv.length+1) do begin Inc(sepCnt, Byte(aPath[i] = directorySeparator)); if sepCnt = 2 then break; Dec(i); end; - pth1 := aPath[i..length(aPath)]; - exit( format('%s%s...%s',[drv,directorySeparator,pth1]) ); + pth1 := aPath[i..aPath.length]; + exit(format('%s%s...%s', [drv, directorySeparator, pth1])); end; function getUserDataPath: string; @@ -624,7 +627,7 @@ begin {$ENDIF} if not DirectoryExists(result) then raise Exception.Create('Coedit failed to retrieve the user data folder'); - if result[length(result)] <> DirectorySeparator then + if result[result.length] <> DirectorySeparator then result += directorySeparator; end; @@ -708,11 +711,11 @@ begin if aPath.isEmpty then exit; // - if aPath[length(aPath)] = '*' then + if aPath[aPath.length] = '*' then begin - pth := aPath[1..length(aPath)-1]; - if pth[length(pth)] in ['/', '\'] then - pth := pth[1..length(pth)-1]; + pth := aPath[1..aPath.length-1]; + if pth[pth.length] in ['/', '\'] then + pth := pth[1..pth.length-1]; if not pth.dirExists then exit(false); // files := TStringList.Create; @@ -930,7 +933,7 @@ var value: char = #0; le: string = LineEnding; begin - result := length(le); + result := le.length; if not fileExists(aFilename) then exit; with TMemoryStream.Create do @@ -1139,7 +1142,7 @@ begin exit; if str[1] = ';' then result := true; - if (length(str) > 1) and (str[1..2] = '//') then + if (str.length > 1) and (str[1..2] = '//') then result := true; end; diff --git a/src/ce_dcd.pas b/src/ce_dcd.pas index 88328685..c0eeaca4 100644 --- a/src/ce_dcd.pas +++ b/src/ce_dcd.pas @@ -238,7 +238,7 @@ end; procedure TCEDcdWrapper.writeSourceToInput; begin fInputSource := fDoc.Text; - fClient.Input.Write(fInputSource[1], length(fInputSource)); + fClient.Input.Write(fInputSource[1], fInputSource.length); fClient.CloseInput; end; @@ -279,7 +279,7 @@ begin // fTempLines.Delete(0); tips := fTempLines.Text; - tips := tips[1..length(tips)-1]; + tips := tips[1..tips.length-1]; end; procedure TCEDcdWrapper.getComplAtCursor(aList: TStrings); @@ -312,8 +312,8 @@ begin for i := 1 to fTempLines.Count-1 do begin item := fTempLines.Strings[i]; - kind := item[length(item)]; - setLength(item, length(item)-2); + kind := item[item.length]; + setLength(item, item.length-2); case kind of 'c': item += ' (class) '; 'i': item += ' (interface) '; @@ -402,7 +402,7 @@ begin i := Pos(#9, str); if i = -1 then exit; - loc := str[i+1..length(str)]; + loc := str[i+1..str.length]; aFilename := str[1..i-1]; loc := ReplaceStr(loc, LineEnding, ''); aPosition := strToIntDef(loc, -1); diff --git a/src/ce_dfmt.pas b/src/ce_dfmt.pas index f4c7799a..f0cad88a 100644 --- a/src/ce_dfmt.pas +++ b/src/ce_dfmt.pas @@ -264,7 +264,7 @@ begin prc.Executable:= exeFullName('dfmt' + exeExt); prc.Execute; inp := fDoc.Lines.Text; - prc.Input.Write(inp[1], length(inp)); + prc.Input.Write(inp[1], inp.length); prc.CloseInput; while prc.Running do (*!*); try diff --git a/src/ce_dubproject.pas b/src/ce_dubproject.pas index 22d6eb9b..336cf8d7 100644 --- a/src/ce_dubproject.pas +++ b/src/ce_dubproject.pas @@ -247,7 +247,7 @@ begin saver.WriteDWord($00BFBBEF); saver.Position:=saver.Position-1; end; - saver.Write(str[1], length(str)); + saver.Write(str[1], str.length); saver.SaveToFile(fFilename); finally saver.Free; diff --git a/src/ce_editor.pas b/src/ce_editor.pas index 16217082..9608a958 100644 --- a/src/ce_editor.pas +++ b/src/ce_editor.pas @@ -446,7 +446,7 @@ begin len := getLineEndingLength(fDoc.fileName); for i := 0 to fDoc.Lines.Count-1 do begin - linelen := length(fDoc.Lines.Strings[i]); + linelen := fDoc.Lines.Strings[i].length; if sum + linelen + len > srcpos then begin fDoc.CaretY := i + 1; diff --git a/src/ce_editoroptions.pas b/src/ce_editoroptions.pas index 0d7fd27c..3299cdd3 100644 --- a/src/ce_editoroptions.pas +++ b/src/ce_editoroptions.pas @@ -483,8 +483,8 @@ begin category := 'Code editor'; identifier:= shrct.actionName; // SynEdit shortcuts start with 'ec' - if length(identifier) > 2 then - identifier := identifier[3..length(identifier)]; + if identifier.length > 2 then + identifier := identifier[3..identifier.length]; aShortcut := shrct.shortcut; // fShortcutCount += 1; @@ -501,9 +501,9 @@ begin for i:= 0 to fShortCuts.Count-1 do begin shc := TCEPersistentShortcut(fShortCuts.Items[i]); - if length(shc.actionName) > 2 then + if shc.actionName.length > 2 then begin - if shc.actionName[3..length(shc.actionName)] <> identifier then + if shc.actionName[3..shc.actionName.length] <> identifier then continue; end else if shc.actionName <> identifier then continue; diff --git a/src/ce_gdb.pas b/src/ce_gdb.pas index c1bd4431..49e84292 100644 --- a/src/ce_gdb.pas +++ b/src/ce_gdb.pas @@ -286,7 +286,7 @@ begin for i:= 0 to fFileLineBrks.Count-1 do begin str := 'break ' + fFileLineBrks.Strings[i] + ':' + intToStr(PtrUInt(fFileLineBrks.Objects[i])) + #10; - fGdb.Input.Write(str[1], length(str)); + fGdb.Input.Write(str[1], str.length); end; // break on druntime exceptions heper + throw' fGdb.OnReadData := @processSilently; @@ -354,7 +354,7 @@ begin aCommand += #10; if assigned(outputCatcher) then fGdb.OnReadData := outputCatcher; - fGdb.Input.Write(aCommand[1], length(aCommand)); + fGdb.Input.Write(aCommand[1], aCommand.length); end; procedure TCEGdbWidget.infoRegs; diff --git a/src/ce_libman.pas b/src/ce_libman.pas index a4a904c4..c351a6f5 100644 --- a/src/ce_libman.pas +++ b/src/ce_libman.pas @@ -181,8 +181,8 @@ begin lst := TStringList.Create; try dir := itm.libFile; - if itm.libFile[length(dir)] = DirectorySeparator then - dir := dir[1..length(dir)-1]; + if itm.libFile[dir.length] = DirectorySeparator then + dir := dir[1..dir.length-1]; listFiles(lst, dir); for j:= 0 to lst.Count-1 do begin diff --git a/src/ce_main.pas b/src/ce_main.pas index 7e3089f9..0821b47c 100644 --- a/src/ce_main.pas +++ b/src/ce_main.pas @@ -1849,7 +1849,7 @@ begin if (j > -1) and (j < i) then continue; // not a switch - if length(cur) < 2 then + if cur.length < 2 then continue; if cur[1] <> '-' then continue; @@ -1861,8 +1861,8 @@ begin RemoveTrailingChars(cur, [#0..#30]); fRunnableSw += (cur + #13); end; - if fRunnableSw.isNotEmpty and (fRunnableSw[length(fRunnableSw)] = #13) then - fRunnableSw := fRunnableSw[1..length(fRunnableSw)-1]; + if fRunnableSw.isNotEmpty and (fRunnableSw[fRunnableSw.length] = #13) then + fRunnableSw := fRunnableSw[1..fRunnableSw.length-1]; if fRunnableSw.isEmpty then fRunnableSw := '-vcolumns'#13'-w'#13'-wi'; // @@ -1884,7 +1884,7 @@ begin if fDoc.Lines.Count = 0 then exit; firstlineFlags := fDoc.Lines[0]; - i := length(firstlineFlags); + i := firstlineFlags.length; if ( i > 18) then begin if firstlineFlags.upperCase[1..17] = '#!RUNNABLE-FLAGS:' then diff --git a/src/ce_messages.pas b/src/ce_messages.pas index 1ef807f8..a8f323da 100644 --- a/src/ce_messages.pas +++ b/src/ce_messages.pas @@ -801,7 +801,7 @@ begin for i := 0 to fToDemangle.Count-1 do begin str := fToDemangle.Strings[i] + LineEnding; - fDemangler.Input.Write(str[1], length(str)); + fDemangler.Input.Write(str[1], str.length); end; fDemangler.CloseInput; end; @@ -954,7 +954,7 @@ begin result := amkBub; while(true) do begin - if pos > length(aMessg) then + if pos > aMessg.length then exit; if aMessg[pos] in [#0..#32, ',', ':', ';'] then begin @@ -988,16 +988,16 @@ begin i := 1; while (true) do begin - if i > length(aMessage) then exit; + if i > aMessage.length then exit; if aMessage[i] = '(' then begin inc(i); - if i > length(aMessage) then exit; + if i > aMessage.length then exit; while( isNumber(aMessage[i]) or (aMessage[i] = ',') or (aMessage[i] = ':')) do begin ident += aMessage[i]; inc(i); - if i > length(aMessage) then exit; + if i > aMessage.length then exit; end; if aMessage[i] = ')' then begin @@ -1008,7 +1008,7 @@ begin else begin result.y := strToIntDef(ident[1..j-1], -1); - result.x := strToIntDef(ident[j+1..length(ident)], -1); + result.x := strToIntDef(ident[j+1..ident.length], -1); end; exit; end; @@ -1027,12 +1027,12 @@ begin while (true) do begin inc(i); - if i > length(aMessage) then + if i > aMessage.length then exit; // '(': line will be indicated after fname // -mixin: dmd, error in mixin(token string) '-mixinXX(' if isEditable(ident.extractFileExt) and ((aMessage[i] = '(') or - ((aMessage[i] = '-') and (i < length(aMessage)-5) + ((aMessage[i] = '-') and (i < aMessage.length-5) and (aMessage[i..i+5] = '-mixin'))) then begin // absolute fname diff --git a/src/ce_miniexplorer.pas b/src/ce_miniexplorer.pas index 59b9fc65..e5709966 100644 --- a/src/ce_miniexplorer.pas +++ b/src/ce_miniexplorer.pas @@ -466,7 +466,7 @@ begin fname := PString(lstFiles.Selected.Data)^; if not fname.fileExists then exit; {$IFNDEF WINDOWS} - fname := fname[2..length(fname)]; + fname := fname[2..fname.length]; {$ENDIF} if isValidNativeProject(fname) then begin @@ -572,7 +572,7 @@ begin for drv in lst do begin itm := Tree.Items.Add(nil, drv); - itm.Data := NewStr(drv[1..length(drv)-1]); + itm.Data := NewStr(drv[1..drv.length-1]); treeScanSubFolders(itm); end; finally @@ -662,7 +662,7 @@ var begin result := false; {$IFDEF LINUX} - if (length(aPath) >= 2) and (aPath[2] <> '/') then + if (aPath.length >= 2) and (aPath[2] <> '/') then aPath := '/' + aPath; {$ENDIF} for i := 0 to aRoot.Count-1 do @@ -670,7 +670,7 @@ begin if aRoot.Items[i].Data.isNil then continue; str := PString(aRoot.Items[i].Data)^; - if SameText(LeftStr(aPath, length(str)), str) then + if SameText(LeftStr(aPath, str.length), str) then begin result := true; Tree.Selected := aRoot.Items[i]; diff --git a/src/ce_nativeproject.pas b/src/ce_nativeproject.pas index 5ecdc31b..393f885f 100644 --- a/src/ce_nativeproject.pas +++ b/src/ce_nativeproject.pas @@ -498,7 +498,7 @@ var // hint for the common dir dirHint := fSrcs.Strings[i]; while (dirHint[1] = '.') or (dirHint[1] = DirectorySeparator) do - dirHint := dirHint[2..length(dirHint)]; + dirHint := dirHint[2..dirHint.length]; ini := fFilename.extractFilePath; if not selectDirectory( format('select the folder (that contains "%s")',[dirHint]), ini, newdir) then exit; @@ -506,7 +506,7 @@ var begin src := fSrcs.Strings[i]; while (src[1] = '.') or (src[1] = DirectorySeparator) do - src := src[2..length(src)]; + src := src[2..src.length]; if fileExists(expandFilenameEx(fBasePath, newdir + DirectorySeparator + src)) then fSrcs.Strings[i] := ExtractRelativepath(fBasePath, newdir + DirectorySeparator + src); hasPatched := true; diff --git a/src/ce_optionseditor.pas b/src/ce_optionseditor.pas index 2bddaa48..412981b2 100644 --- a/src/ce_optionseditor.pas +++ b/src/ce_optionseditor.pas @@ -250,7 +250,7 @@ begin if aEditor.GetComponent(0) is TComponent then begin nme := aEditor.GetPropInfo^.Name; - len := length(nme); + len := nme.length; // TODO-cbugfix: filtering does not work on sub componenets 'e.g D2HL options) if (len > 2) and (nme[len - 2 .. len] = 'Tag') then aShow := false diff --git a/src/ce_procinput.pas b/src/ce_procinput.pas index 394d68d2..71ff20c6 100644 --- a/src/ce_procinput.pas +++ b/src/ce_procinput.pas @@ -119,7 +119,7 @@ begin inp := symbolExpander.get(txtInp.Text) + lineEnding else inp := txtInp.Text + lineEnding; - fProc.Input.Write(inp[1], length(inp)); + fProc.Input.Write(inp[1], inp.length); txtInp.Text := ''; end; diff --git a/src/ce_search.pas b/src/ce_search.pas index 4c52c41e..ea6c3e09 100644 --- a/src/ce_search.pas +++ b/src/ce_search.pas @@ -186,10 +186,10 @@ var begin inherited; for i := fMrReplacements.Count-1 downto 0 do - if length(fMrReplacements[i]) > 128 then + if fMrReplacements[i].length > 128 then fMrReplacements.Delete(i); for i := fMrSearches.Count-1 downto 0 do - if length(fMrSearches[i]) > 128 then + if fMrSearches[i].length > 128 then fMrSearches.Delete(i); end; {$ENDREGION} @@ -384,7 +384,7 @@ begin if chkBack.Checked then fDoc.CaretX := fDoc.CaretX - 1 else - fDoc.CaretX := fDoc.CaretX + length(fToFind); + fDoc.CaretX := fDoc.CaretX + fToFind.length; end; if fDoc.SearchReplace(fToFind, '', getOptions) = 0 then dlgOkInfo('the expression cannot be found') @@ -420,7 +420,7 @@ begin if chkBack.Checked then fDoc.CaretX := fDoc.CaretX - 1 else - fDoc.CaretX := fDoc.CaretX + length(fToFind); + fDoc.CaretX := fDoc.CaretX + fToFind.length; end; if fDoc.SearchReplace(fToFind, fReplaceWth, getOptions + [ssoReplace]) <> 0 then fHasSearched := true; diff --git a/src/ce_shortcutseditor.lfm b/src/ce_shortcutseditor.lfm index a1381a4b..3b9a990a 100644 --- a/src/ce_shortcutseditor.lfm +++ b/src/ce_shortcutseditor.lfm @@ -6,6 +6,8 @@ object CEShortcutEditor: TCEShortcutEditor ClientHeight = 463 ClientWidth = 424 TabOrder = 0 + DesignLeft = 678 + DesignTop = 216 object Panel1: TPanel Left = 0 Height = 463 diff --git a/src/ce_shortcutseditor.pas b/src/ce_shortcutseditor.pas index f343b0db..9e53860d 100644 --- a/src/ce_shortcutseditor.pas +++ b/src/ce_shortcutseditor.pas @@ -6,7 +6,7 @@ interface uses Classes, SysUtils, FileUtil, TreeFilterEdit, Forms, Controls, Menus, Graphics, - ExtCtrls, LCLProc, ComCtrls, StdCtrls, Buttons, LCLType, + ExtCtrls, LCLProc, ComCtrls, StdCtrls, Buttons, LCLType, PropEdits, ce_sharedres, ce_observer, ce_interfaces, ce_common, ce_writableComponent, ce_dialogs; diff --git a/src/ce_staticmacro.pas b/src/ce_staticmacro.pas index 065c9906..9acc355f 100644 --- a/src/ce_staticmacro.pas +++ b/src/ce_staticmacro.pas @@ -354,12 +354,12 @@ begin for i := fMacros.Count-1 downto 0 do begin text := fMacros.Strings[i]; - if length(text) >= 4 then + if text.length >= 4 then if text[1] = '$' then if Pos('=', text) > 2 then begin macro := fMacros.Names[i]; - if (macro[length(macro)] in ['a'..'z', 'A'..'Z', '0'..'9']) then + if (macro[macro.length] in ['a'..'z', 'A'..'Z', '0'..'9']) then continue; end; fMacros.Delete(i); diff --git a/src/ce_symlist.pas b/src/ce_symlist.pas index 65eb0652..f9e4edb1 100644 --- a/src/ce_symlist.pas +++ b/src/ce_symlist.pas @@ -671,7 +671,7 @@ begin fToolProc.CurrentDirectory := ExtractFileDir(Application.ExeName); fToolProc.Execute; str := fDoc.Text; - fToolProc.Input.Write(str[1], length(str)); + fToolProc.Input.Write(str[1], str.length); fToolProc.CloseInput; end; diff --git a/src/ce_symstring.pas b/src/ce_symstring.pas index 48a45800..505e454a 100644 --- a/src/ce_symstring.pas +++ b/src/ce_symstring.pas @@ -144,7 +144,6 @@ begin exit; fNeedUpdate := true; end; - {$ENDREGION} {$REGION Symbol things ---------------------------------------------------------} @@ -259,7 +258,7 @@ begin end; end; until - i = length(symString); + i = symString.length; elems.Add(elem); elem := ''; for i := 0 to elems.Count - 1 do diff --git a/src/ce_synmemo.pas b/src/ce_synmemo.pas index 5e30ed7f..bc9443c1 100644 --- a/src/ce_synmemo.pas +++ b/src/ce_synmemo.pas @@ -376,7 +376,7 @@ begin fname := getCoeditDocPath + 'editorcache' + DirectorySeparator; ForceDirectories(fname); chksm := crc32(0, nil, 0); - chksm := crc32(chksm, @tempn[1], length(tempn)); + chksm := crc32(chksm, @tempn[1], tempn.length); fname := fname + format('%.8X.txt', [chksm]); saveToFile(fname); end; @@ -392,7 +392,7 @@ begin // fname := getCoeditDocPath + 'editorcache' + DirectorySeparator; chksm := crc32(0, nil, 0); - chksm := crc32(chksm, @tempn[1], length(tempn)); + chksm := crc32(chksm, @tempn[1], tempn.length); fname := fname + format('%.8X.txt', [chksm]); // if not fname.fileExists then exit; @@ -765,9 +765,9 @@ begin if beg.isEmpty then exit; while true do begin - if (i > length(beg)) or not (beg[i] in blk) then + if (i > beg.length) or not (beg[i] in blk) then break; - i += 1 + i += 1; end; i -= 1; editor.BeginUndoBlock; @@ -958,7 +958,7 @@ procedure TCESynMemo.completionCodeCompletion(var Value: string; Shift: TShiftState); begin // warning: '20' depends on ce_dcd, case knd of, string literals length - Value := Value[1..length(Value)-20]; + Value := Value[1..Value.length-20]; end; function TCESynMemo.completionItemPaint(const AKey: string; ACanvas: TCanvas;X, Y: integer; @@ -972,8 +972,8 @@ begin // otherwise always at least 20 chars but... // ... '20' depends on ce_dcd, case knd of, string literals length result := true; - lft := AKey[1 .. length(AKey)-20]; - rgt := AKey[length(AKey)-19 .. length(AKey)]; + lft := AKey[1 .. AKey.length-20]; + rgt := AKey[AKey.length-19 .. AKey.length]; ACanvas.Font.Style := [fsBold]; len := ACanvas.TextExtent(lft).cx; ACanvas.TextOut(2 + X , Y, lft); @@ -1010,19 +1010,19 @@ var i: integer; begin fIdentifier := GetWordAtRowCol(LogicalCaretXY); - if (length(fIdentifier) > 2) and (not SelAvail) then + if (fIdentifier.length > 2) and (not SelAvail) then SetHighlightSearch(fIdentifier, fMatchIdentOpts) else if SelAvail then begin str := SelText; - for i := 1 to length(str) do + for i := 1 to str.length do begin if not (str[i] in [' ', #10, #13]) then begin SetHighlightSearch(str, fMatchSelectionOpts); break; end; - if i = length(str) then + if i = str.length then SetHighlightSearch('', []); end; end @@ -1194,7 +1194,7 @@ var begin result := 0; if fMousePos.y-1 > Lines.Count-1 then exit; - llen := length(Lines.Strings[fMousePos.y-1]); + llen := Lines.Strings[fMousePos.y-1].length; if fMousePos.X > llen then exit; // // something note really clear: @@ -1202,7 +1202,7 @@ begin // TCESynMemo.getMouseFileBytePos works when using the line ending from the system. len := getSysLineEndLen; for i:= 0 to fMousePos.y-2 do - result += length(Lines.Strings[i]) + len; + result += Lines.Strings[i].length + len; result += fMousePos.x; end; {$ENDREGION --------------------------------------------------------------------} @@ -1270,7 +1270,7 @@ begin begin if fAutoCloseCurlyBrace = autoCloseAlways then curlyBraceCloseAndIndent(self) - else if (CaretY = Lines.Count) and (CaretX = length(LineText)+1) then + else if (CaretY = Lines.Count) and (CaretX = LineText.length+1) then curlyBraceCloseAndIndent(self); end; end; diff --git a/src/ce_tools.pas b/src/ce_tools.pas index 8b139b04..5a1f7f25 100644 --- a/src/ce_tools.pas +++ b/src/ce_tools.pas @@ -224,8 +224,8 @@ begin begin setLength(inp, previous.process.OutputStack.Size); previous.process.OutputStack.Position:=0; - previous.process.OutputStack.Read(inp[1], length(inp)); - fProcess.Input.Write(inp[1], length(inp)); + previous.process.OutputStack.Read(inp[1], inp.length); + fProcess.Input.Write(inp[1], inp.length); fProcess.CloseInput; end; end; @@ -420,7 +420,7 @@ begin and aTool.fProcess.Input.isNotNil then begin txt := fDoc.Text; - aTool.fProcess.Input.Write(txt[1], length(txt)); + aTool.fProcess.Input.Write(txt[1], txt.length); aTool.fProcess.CloseInput; end; end; diff --git a/wiki/wiki.txt b/wiki/wiki.txt index 996cc26f..28c0830f 100644 --- a/wiki/wiki.txt +++ b/wiki/wiki.txt @@ -298,9 +298,9 @@ To do so, the application option _Native project compiler_ must be set according # DUB projects. -Since the version 2 alpha 1, Coedit also handles DUB projects. +Since the version 2 alpha 1, Coedit also handles [DUB](http://code.dlang.org/getting_started) projects. -DUB project description must be in JSON format, SDL in not supported. +DUB project description must be in [JSON format](http://code.dlang.org/package-format?lang=json), [SDL](http://code.dlang.org/package-format?lang=sdl) in not supported. DUB projects are handled exactly as CE projects are. The _project_ menu proposes the same features. However the configuration is done in another widget, see the [dedicated paragraph][lnk_widg_dub]. @@ -541,7 +541,7 @@ Coedit handles the task automatically (see later in the project configuration wi - ![](https://raw.githubusercontent.com/BBasile/Coedit/master/icons/arrow/arrow_up.png) **/** ![](https://raw.githubusercontent.com/BBasile/Coedit/master/icons/arrow/arrow_down.png): change selected entry position. - ![](https://raw.githubusercontent.com/BBasile/Coedit/master/icons/book/book_link.png): if the current project _binaryKind_ is set to _staticlib_ then the _libman_ will use its parameters to create an entry. This avoids to browse in the dialogs, for example if you wish to setup several [_metad_][lnk_metad] items. Note that sometimes the sources root folder has to be adjusted. - ![](https://raw.githubusercontent.com/BBasile/Coedit/master/icons/book/book_open.png): if the selected item defines a _project_ then closes current project and opens the one matching to the entry. -- ![](https://raw.githubusercontent.com/BBasile/Coedit/master/icons/other/dub_small.png): allows to fetch the master version of a DUB registry item. When the button is clicked, an input field allows to type the library name, after what, if the name is valid, the library will be downloaded, compiled and a new entry automatically filled. This features is actually more useful for the CE projects and the runnable modules as the dependencies of a DUB projects are handled automatically. It allows to use every DUB library in a CE project, even if the package doesn't include a CE project file. +- ![](https://raw.githubusercontent.com/BBasile/Coedit/master/icons/other/dub_small.png): allows to fetch the master version of a [DUB registry item](http://code.dlang.org/). When the button is clicked, an input field allows to type the library name, after what, if the name is valid, the library will be downloaded, compiled and a new entry automatically filled. This features is actually more useful for the CE projects and the runnable modules as the dependencies of a DUB projects are handled automatically. It allows to use every DUB library in a CE project, even if the package doesn't include a CE project file. - ![](https://raw.githubusercontent.com/BBasile/Coedit/master/icons/book/book_edit.png): edit the item alias. - ![](https://raw.githubusercontent.com/BBasile/Coedit/master/icons/folder/folder_brick.png): select the library file. In some rare case, this field can be omitted (for example if the library file is set in the _sc.ini_). This can be skipped if the library is only a small orphan _d_ source that's not been compiled as a static library or if the entry is only used for the [DCD][lnk_dcd] completion. @@ -753,7 +753,8 @@ The DUB project editor is widget is divided in two panels: ![](https://raw.githubusercontent.com/BBasile/CoeditWikiData/master/dub_inspect.png) -The first panel displays the sources list and the combination of _each build type_ with each _build configuration_. Sources can be opened in a new editor by double clicking. To select a configuration defines which type and which configuration will be build by DUB when clicking _compile_ in the _project_ menu. +The first panel displays the sources list and the combination of _each build type_ with each _build configuration_. Sources can be opened in a new editor by double clicking. +Selecting a configuration defines which _buildType_ type and which _configuration_ will be build by DUB when clicking _compile_ in the _project_ menu. Note that it's possible to specify which compiler DUB uses in the application options _dubCompiler_. #### Editor @@ -765,7 +766,7 @@ The second panel displays the tree of the project properties. The can be modifie New properties can be added or removed: * ![](https://raw.githubusercontent.com/BBasile/Coedit/master/icons/other/textfield_delete.png): removes the selected property. Note that the effect is not reflected until the project is saved as a file (since Coedit does not communicate directly with DUB). -* ![](https://raw.githubusercontent.com/BBasile/Coedit/master/icons/other/textfield_add.png): show a small dialog that allows to add a new value, a new array or new object. This requires to master the DUB format. In the dialog, the value of the text field is only used when an object or a value is added. It matches to the _key_, not the value itself. +* ![](https://raw.githubusercontent.com/BBasile/Coedit/master/icons/other/textfield_add.png): shows a small dialog that allows to add a new value, a new array or a new object. This requires to master the [DUB JSON format](http://code.dlang.org/package-format?lang=json). In the dialog, the value of the text field is only used when an object or a value is added. It matches to the _key_, not the value itself. ![](https://raw.githubusercontent.com/BBasile/CoeditWikiData/master/dub_edit2.png) @@ -842,7 +843,7 @@ Toolbar: A tool can be selected from the left side of the widget. If selected, a property inspector displays the options that can be edited: -- clearMessages: if the tool standard output is redirected to the [messages widget][lnk_widg_msg] then the previous messages are cleared before the execution. The output is redirected to the messages when **popUsePipes** is set and if the **nextToolALias** is empty. +- clearMessages: if the tool standard output is redirected to the [messages widget][lnk_widg_msg] then the previous messages are cleared before the execution. The output is redirected to the messages when **popUsePipes** is set and if the **nextToolAlias** is empty. - editorToInput: when set, the content of the current editor is streamed to the tool standard input. - executable: the tool file name. If the system cannot find its path in the environment variables then it must be included. The field can include a [symbolic string][lnk_sym]. - nextToolAlias: defines the alias of another tool that will be launched after this one returns.