mirror of https://gitlab.com/basile.b/dexed.git
DCD hints loc and decl finder always use system LE ?
This commit is contained in:
parent
a346e6c4ee
commit
ac82a0aba8
|
@ -207,7 +207,9 @@ type
|
||||||
(**
|
(**
|
||||||
* Returns the length of the line ending in aFilename;
|
* Returns the length of the line ending in aFilename;
|
||||||
*)
|
*)
|
||||||
function getLineEndingLength(const aFilename: string): byte;
|
//function getLineEndingLength(const aFilename: string): byte;
|
||||||
|
|
||||||
|
function getSysLineEndLen: byte;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
|
@ -756,32 +758,43 @@ begin
|
||||||
aProcess.Options := aProcess.Options + [poNewConsole];
|
aProcess.Options := aProcess.Options + [poNewConsole];
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function getLineEndingLength(const aFilename: string): byte;
|
// TODO-cbugfix: confirm that DCD location info are based on system Line ending and not the one existing in a specific file
|
||||||
var
|
|
||||||
value: char;
|
//function getLineEndingLength(const aFilename: string): byte;
|
||||||
le: string;
|
//var
|
||||||
|
// value: char;
|
||||||
|
// le: string;
|
||||||
|
//begin
|
||||||
|
// value := #0;
|
||||||
|
// le := LineEnding;
|
||||||
|
// result := length(le);
|
||||||
|
// if not fileExists(aFilename) then
|
||||||
|
// exit;
|
||||||
|
// with TMemoryStream.Create do
|
||||||
|
// try
|
||||||
|
// LoadFromFile(aFilename);
|
||||||
|
// while true do
|
||||||
|
// begin
|
||||||
|
// if Position = Size then
|
||||||
|
// exit;
|
||||||
|
// read(value,1);
|
||||||
|
// if value = #10 then
|
||||||
|
// exit(1);
|
||||||
|
// if value = #13 then
|
||||||
|
// exit(2);
|
||||||
|
// end;
|
||||||
|
// finally
|
||||||
|
// Free;
|
||||||
|
// end;
|
||||||
|
//end;
|
||||||
|
|
||||||
|
function getSysLineEndLen: byte;
|
||||||
begin
|
begin
|
||||||
value := #0;
|
{$IFDEF WINDOWS}
|
||||||
le := LineEnding;
|
exit(2);
|
||||||
result := length(le);
|
{$ELSE}
|
||||||
if not fileExists(aFilename) then
|
exit(1);
|
||||||
exit;
|
{$ENDIF}
|
||||||
with TMemoryStream.Create do
|
|
||||||
try
|
|
||||||
LoadFromFile(aFilename);
|
|
||||||
while true do
|
|
||||||
begin
|
|
||||||
if Position = Size then
|
|
||||||
exit;
|
|
||||||
read(value,1);
|
|
||||||
if value = #10 then
|
|
||||||
exit(1);
|
|
||||||
if value = #13 then
|
|
||||||
exit(2);
|
|
||||||
end;
|
|
||||||
finally
|
|
||||||
Free;
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{$IFDEF WINDOWS}
|
{$IFDEF WINDOWS}
|
||||||
|
|
|
@ -378,7 +378,8 @@ begin
|
||||||
// note: SelStart only matches srcpos if the target file has the same line ending
|
// note: SelStart only matches srcpos if the target file has the same line ending
|
||||||
// as the operating system: the pos has to be found manually.
|
// as the operating system: the pos has to be found manually.
|
||||||
sum := 0;
|
sum := 0;
|
||||||
len := getLineEndingLength(fDoc.fileName);
|
//len := getLineEndingLength(fDoc.fileName);
|
||||||
|
len := getSysLineEndLen;
|
||||||
for i := 0 to fDoc.Lines.Count-1 do
|
for i := 0 to fDoc.Lines.Count-1 do
|
||||||
begin
|
begin
|
||||||
linelen := length(fDoc.Lines.Strings[i]);
|
linelen := length(fDoc.Lines.Strings[i]);
|
||||||
|
|
|
@ -620,9 +620,9 @@ var
|
||||||
i, len: Integer;
|
i, len: Integer;
|
||||||
begin
|
begin
|
||||||
result := 0;
|
result := 0;
|
||||||
len := getLineEndingLength(fFilename);
|
//len := getLineEndingLength(fFilename);
|
||||||
for i:= 0 to fMousePos.y-2 do
|
for i:= 0 to fMousePos.y-2 do
|
||||||
result += length(Lines.Strings[i]) + len;
|
result += length(Lines.Strings[i]) + getSysLineEndLen;
|
||||||
result += fMousePos.x;
|
result += fMousePos.x;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -641,7 +641,7 @@ begin
|
||||||
((dy < 0) and (dy > -5) or (dy > 0) and (dy < 5)) then
|
((dy < 0) and (dy > -5) or (dy > 0) and (dy < 5)) then
|
||||||
fCanShowHint:=true;
|
fCanShowHint:=true;
|
||||||
fOldMousePos := Point(X, Y);
|
fOldMousePos := Point(X, Y);
|
||||||
fMousePos := PixelsToRowColumn(fOldMousePos);
|
fMousePos := PixelsToRowColumn(fOldMousePos, []);
|
||||||
if ssLeft in Shift then
|
if ssLeft in Shift then
|
||||||
identifierToD2Syn;
|
identifierToD2Syn;
|
||||||
end;
|
end;
|
||||||
|
|
Loading…
Reference in New Issue