This commit is contained in:
Basile Burg 2015-03-17 04:01:53 +01:00
parent d6d6fab659
commit 2c325dceef
3 changed files with 37 additions and 32 deletions

View File

@ -207,7 +207,7 @@ 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; function getSysLineEndLen: byte;
@ -760,33 +760,33 @@ end;
// TODO-cbugfix: confirm that DCD location info are based on system Line ending and not the one existing in a specific file // TODO-cbugfix: confirm that DCD location info are based on system Line ending and not the one existing in a specific file
//function getLineEndingLength(const aFilename: string): byte; function getLineEndingLength(const aFilename: string): byte;
//var var
// value: char; value: char;
// le: string; le: string;
//begin begin
// value := #0; value := #0;
// le := LineEnding; le := LineEnding;
// result := length(le); result := length(le);
// if not fileExists(aFilename) then if not fileExists(aFilename) then
// exit; exit;
// with TMemoryStream.Create do with TMemoryStream.Create do
// try try
// LoadFromFile(aFilename); LoadFromFile(aFilename);
// while true do while true do
// begin begin
// if Position = Size then if Position = Size then
// exit; exit;
// read(value,1); read(value,1);
// if value = #10 then if value = #10 then
// exit(1); exit(1);
// if value = #13 then if value = #13 then
// exit(2); exit(2);
// end; end;
// finally finally
// Free; Free;
// end; end;
//end; end;
function getSysLineEndLen: byte; function getSysLineEndLen: byte;
begin begin

View File

@ -378,8 +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; //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]);

View File

@ -621,9 +621,14 @@ var
begin begin
result := 0; result := 0;
//len := getLineEndingLength(fFilename); //len := getLineEndingLength(fFilename);
len := getSysLineEndLen;
for i:= 0 to fMousePos.y-2 do for i:= 0 to fMousePos.y-2 do
result += length(Lines.Strings[i]) + getSysLineEndLen; result += length(Lines.Strings[i]) + len;
result += fMousePos.x; result += fMousePos.x;
//getMessageDisplay.message(format('%d - %d : %d',[fMousePos.x, fMousePos.y, result]),nil,amcMisc,amkBub);
end; end;
procedure TCESynMemo.MouseMove(Shift: TShiftState; X, Y: Integer); procedure TCESynMemo.MouseMove(Shift: TShiftState; X, Y: Integer);
@ -641,7 +646,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;