mirror of https://gitlab.com/basile.b/dexed.git
fix, DCD and TCESynmemo positions issues, (hints, goto decl)
This commit is contained in:
parent
2c325dceef
commit
0c34c8999e
|
@ -304,6 +304,9 @@ begin
|
||||||
if not fAvailable then exit;
|
if not fAvailable then exit;
|
||||||
if fDoc = nil then exit;
|
if fDoc = nil then exit;
|
||||||
//
|
//
|
||||||
|
i := fDoc.MouseStart;
|
||||||
|
if i = 0 then exit;
|
||||||
|
//
|
||||||
fTempLines.Assign(fDoc.Lines);
|
fTempLines.Assign(fDoc.Lines);
|
||||||
fTempLines.SaveToFile(fDoc.tempFilename);
|
fTempLines.SaveToFile(fDoc.tempFilename);
|
||||||
//
|
//
|
||||||
|
@ -311,7 +314,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.MouseStart - 1));
|
fClient.Parameters.Add(intToStr(i - 1));
|
||||||
fClient.Parameters.Add(fDoc.tempFilename);
|
fClient.Parameters.Add(fDoc.tempFilename);
|
||||||
fClient.Execute;
|
fClient.Execute;
|
||||||
//
|
//
|
||||||
|
|
|
@ -19,7 +19,7 @@ inherited CEEditorWidget: TCEEditorWidget
|
||||||
ClientWidth = 465
|
ClientWidth = 465
|
||||||
object PageControl: TExtendedNotebook[0]
|
object PageControl: TExtendedNotebook[0]
|
||||||
Left = 3
|
Left = 3
|
||||||
Height = 375
|
Height = 380
|
||||||
Top = 3
|
Top = 3
|
||||||
Width = 459
|
Width = 459
|
||||||
Align = alClient
|
Align = alClient
|
||||||
|
@ -32,8 +32,8 @@ inherited CEEditorWidget: TCEEditorWidget
|
||||||
end
|
end
|
||||||
object editorStatus: TStatusBar[1]
|
object editorStatus: TStatusBar[1]
|
||||||
Left = 3
|
Left = 3
|
||||||
Height = 23
|
Height = 18
|
||||||
Top = 380
|
Top = 385
|
||||||
Width = 459
|
Width = 459
|
||||||
BorderSpacing.Around = 2
|
BorderSpacing.Around = 2
|
||||||
Panels = <
|
Panels = <
|
||||||
|
|
|
@ -375,11 +375,8 @@ begin
|
||||||
openDocument(fname);
|
openDocument(fname);
|
||||||
if srcpos <> -1 then
|
if srcpos <> -1 then
|
||||||
begin
|
begin
|
||||||
// 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.
|
|
||||||
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]);
|
||||||
|
@ -388,6 +385,7 @@ begin
|
||||||
fDoc.CaretY := i + 1;
|
fDoc.CaretY := i + 1;
|
||||||
fDoc.CaretX := srcpos - sum + len;
|
fDoc.CaretX := srcpos - sum + len;
|
||||||
fDoc.SelectWord;
|
fDoc.SelectWord;
|
||||||
|
fDoc.EnsureCursorPosVisible;
|
||||||
break;
|
break;
|
||||||
end;
|
end;
|
||||||
sum += linelen;
|
sum += linelen;
|
||||||
|
|
|
@ -5,9 +5,10 @@ unit ce_synmemo;
|
||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, controls,lcltype, Forms, graphics, ExtCtrls, crc, SynEditKeyCmds,
|
Classes, SysUtils, controls,lcltype, Forms, graphics, ExtCtrls, crc, math,
|
||||||
LazSynEditText, SynEditHighlighter, SynEdit, SynHighlighterLFM, SynEditMouseCmds,
|
SynEditKeyCmds,LazSynEditText, SynEditHighlighter, SynEdit, SynHighlighterLFM,
|
||||||
SynEditFoldedView, ce_common, ce_observer, ce_writableComponent, ce_d2syn, ce_txtsyn;
|
SynEditMouseCmds, SynEditFoldedView, ce_common, ce_observer, ce_writableComponent,
|
||||||
|
ce_d2syn, ce_txtsyn;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
|
@ -440,7 +441,7 @@ begin
|
||||||
fDDocWin.FontSize := Font.Size;
|
fDDocWin.FontSize := Font.Size;
|
||||||
fDDocWin.HintRect := fDDocWin.CalcHintRect(0, str, nil);
|
fDDocWin.HintRect := fDDocWin.CalcHintRect(0, str, nil);
|
||||||
fDDocWin.OffsetHintRect(mouse.CursorPos, Font.Size);
|
fDDocWin.OffsetHintRect(mouse.CursorPos, Font.Size);
|
||||||
fDDocWin.ActivateHint(fDDocWin.HintRect, str);
|
fDDocWin.ActivateHint(fDDocWin.HintRect, str);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -575,11 +576,13 @@ begin
|
||||||
identifierToD2Syn;
|
identifierToD2Syn;
|
||||||
if not (Shift = [ssCtrl]) then exit;
|
if not (Shift = [ssCtrl]) then exit;
|
||||||
//
|
//
|
||||||
|
IncPaintLock;
|
||||||
case Key of
|
case Key of
|
||||||
VK_ADD: if Font.Size < 50 then Font.Size := Font.Size + 1;
|
VK_ADD: if Font.Size < 50 then Font.Size := Font.Size + 1;
|
||||||
VK_SUBTRACT: if Font.Size > 3 then Font.Size := Font.Size - 1;
|
VK_SUBTRACT: if Font.Size > 3 then Font.Size := Font.Size - 1;
|
||||||
VK_DECIMAL: Font.Size := fDefaultFontSize;
|
VK_DECIMAL: Font.Size := fDefaultFontSize;
|
||||||
end;
|
end;
|
||||||
|
DecPaintLock;
|
||||||
TCEEditorHintWindow.FontSize := Font.Size;
|
TCEEditorHintWindow.FontSize := Font.Size;
|
||||||
fCanShowHint:=false;
|
fCanShowHint:=false;
|
||||||
fDDocWin.Hide;
|
fDDocWin.Hide;
|
||||||
|
@ -617,18 +620,20 @@ end;
|
||||||
|
|
||||||
function TCESynMemo.getMouseFileBytePos: Integer;
|
function TCESynMemo.getMouseFileBytePos: Integer;
|
||||||
var
|
var
|
||||||
i, len: Integer;
|
i, len, llen: Integer;
|
||||||
begin
|
begin
|
||||||
result := 0;
|
result := 0;
|
||||||
//len := getLineEndingLength(fFilename);
|
if fMousePos.y-1 > Lines.Count-1 then exit;
|
||||||
|
llen := length(Lines.Strings[fMousePos.y-1]);
|
||||||
|
if fMousePos.X > llen then exit;
|
||||||
|
//
|
||||||
|
// something note really clear:
|
||||||
|
// TCEEditorWidget.getSymbolLoc works when using the line ending from the filename.
|
||||||
|
// TCESynMemo.getMouseFileBytePos works when using the line ending from the system.
|
||||||
len := getSysLineEndLen;
|
len := getSysLineEndLen;
|
||||||
|
|
||||||
|
|
||||||
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]) + 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);
|
||||||
|
|
Loading…
Reference in New Issue