mirror of https://gitlab.com/basile.b/dexed.git
prepared code to get symb documentation at mouse position
This commit is contained in:
parent
ea33425ffd
commit
1ecb859698
|
|
@ -222,6 +222,11 @@ type
|
||||||
*)
|
*)
|
||||||
procedure ensureNoPipeIfWait(aProcess: TProcess);
|
procedure ensureNoPipeIfWait(aProcess: TProcess);
|
||||||
|
|
||||||
|
(**
|
||||||
|
* Returns the length of the line ending in aFilename;
|
||||||
|
*)
|
||||||
|
function getLineEndingLength(const aFilename: string): byte;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
{$IFDEF LINUX}
|
{$IFDEF LINUX}
|
||||||
|
|
@ -825,6 +830,35 @@ begin
|
||||||
aProcess.Options := aProcess.Options + [poNewConsole];
|
aProcess.Options := aProcess.Options + [poNewConsole];
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function getLineEndingLength(const aFilename: string): byte;
|
||||||
|
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;
|
||||||
|
|
||||||
|
|
||||||
initialization
|
initialization
|
||||||
RegisterClasses([TMRUList, TMRUFileList]);
|
RegisterClasses([TMRUList, TMRUFileList]);
|
||||||
dExtList := TStringList.Create;
|
dExtList := TStringList.Create;
|
||||||
|
|
|
||||||
|
|
@ -250,7 +250,7 @@ begin
|
||||||
fClient.Parameters.Clear;
|
fClient.Parameters.Clear;
|
||||||
fClient.Parameters.Add('-d');
|
fClient.Parameters.Add('-d');
|
||||||
fClient.Parameters.Add('-c');
|
fClient.Parameters.Add('-c');
|
||||||
fClient.Parameters.Add(intToStr(fDoc.SelStart-1));
|
fClient.Parameters.Add(intToStr(fDoc.MouseStart -1));
|
||||||
fClient.Parameters.Add(fDoc.tempFilename);
|
fClient.Parameters.Add(fDoc.tempFilename);
|
||||||
fClient.Execute;
|
fClient.Execute;
|
||||||
//
|
//
|
||||||
|
|
|
||||||
|
|
@ -76,6 +76,8 @@ type
|
||||||
fMultiDocSubject: TCECustomSubject;
|
fMultiDocSubject: TCECustomSubject;
|
||||||
fStoredFontSize: Integer;
|
fStoredFontSize: Integer;
|
||||||
fPositions: TCESynMemoPositions;
|
fPositions: TCESynMemoPositions;
|
||||||
|
fMousePos: TPoint;
|
||||||
|
function getMouseStart: Integer;
|
||||||
procedure changeNotify(Sender: TObject);
|
procedure changeNotify(Sender: TObject);
|
||||||
procedure identifierToD2Syn;
|
procedure identifierToD2Syn;
|
||||||
procedure saveCache;
|
procedure saveCache;
|
||||||
|
|
@ -108,6 +110,8 @@ type
|
||||||
property isDSource: boolean read fIsDSource;
|
property isDSource: boolean read fIsDSource;
|
||||||
property isProjectSource: boolean read fIsConfig;
|
property isProjectSource: boolean read fIsConfig;
|
||||||
property TextView;
|
property TextView;
|
||||||
|
//
|
||||||
|
property MouseStart: Integer read getMouseStart;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
|
|
@ -510,11 +514,23 @@ begin
|
||||||
StaticEditorMacro.Execute;
|
StaticEditorMacro.Execute;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TCESynMemo.getMouseStart: Integer;
|
||||||
|
var
|
||||||
|
i, le: Integer;
|
||||||
|
begin
|
||||||
|
result := 0;
|
||||||
|
le := getLineEndingLength(fFilename);
|
||||||
|
for i:= 0 to fMousePos.y-2 do
|
||||||
|
result += length(Lines.Strings[i]) + le;
|
||||||
|
result += fMousePos.x;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCESynMemo.MouseMove(Shift: TShiftState; X, Y: Integer);
|
procedure TCESynMemo.MouseMove(Shift: TShiftState; X, Y: Integer);
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
if ssLeft in Shift then
|
if ssLeft in Shift then
|
||||||
identifierToD2Syn;
|
identifierToD2Syn;
|
||||||
|
fMousePos := PixelsToRowColumn(Point(X,Y));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCESynMemo.MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y:Integer);
|
procedure TCESynMemo.MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y:Integer);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue