fix, DCD and TCESynmemo positions issues, (hints, goto decl)

This commit is contained in:
Basile Burg 2015-03-17 04:53:40 +01:00
parent 2c325dceef
commit 0c34c8999e
4 changed files with 23 additions and 17 deletions

View File

@ -304,6 +304,9 @@ begin
if not fAvailable then exit;
if fDoc = nil then exit;
//
i := fDoc.MouseStart;
if i = 0 then exit;
//
fTempLines.Assign(fDoc.Lines);
fTempLines.SaveToFile(fDoc.tempFilename);
//
@ -311,7 +314,7 @@ begin
fClient.Parameters.Clear;
fClient.Parameters.Add('-d');
fClient.Parameters.Add('-c');
fClient.Parameters.Add(intToStr(fDoc.MouseStart - 1));
fClient.Parameters.Add(intToStr(i - 1));
fClient.Parameters.Add(fDoc.tempFilename);
fClient.Execute;
//

View File

@ -19,7 +19,7 @@ inherited CEEditorWidget: TCEEditorWidget
ClientWidth = 465
object PageControl: TExtendedNotebook[0]
Left = 3
Height = 375
Height = 380
Top = 3
Width = 459
Align = alClient
@ -32,8 +32,8 @@ inherited CEEditorWidget: TCEEditorWidget
end
object editorStatus: TStatusBar[1]
Left = 3
Height = 23
Top = 380
Height = 18
Top = 385
Width = 459
BorderSpacing.Around = 2
Panels = <

View File

@ -375,11 +375,8 @@ begin
openDocument(fname);
if srcpos <> -1 then
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;
len := getLineEndingLength(fDoc.fileName);
//len := getSysLineEndLen;
for i := 0 to fDoc.Lines.Count-1 do
begin
linelen := length(fDoc.Lines.Strings[i]);
@ -388,6 +385,7 @@ begin
fDoc.CaretY := i + 1;
fDoc.CaretX := srcpos - sum + len;
fDoc.SelectWord;
fDoc.EnsureCursorPosVisible;
break;
end;
sum += linelen;

View File

@ -5,9 +5,10 @@ unit ce_synmemo;
interface
uses
Classes, SysUtils, controls,lcltype, Forms, graphics, ExtCtrls, crc, SynEditKeyCmds,
LazSynEditText, SynEditHighlighter, SynEdit, SynHighlighterLFM, SynEditMouseCmds,
SynEditFoldedView, ce_common, ce_observer, ce_writableComponent, ce_d2syn, ce_txtsyn;
Classes, SysUtils, controls,lcltype, Forms, graphics, ExtCtrls, crc, math,
SynEditKeyCmds,LazSynEditText, SynEditHighlighter, SynEdit, SynHighlighterLFM,
SynEditMouseCmds, SynEditFoldedView, ce_common, ce_observer, ce_writableComponent,
ce_d2syn, ce_txtsyn;
type
@ -440,7 +441,7 @@ begin
fDDocWin.FontSize := Font.Size;
fDDocWin.HintRect := fDDocWin.CalcHintRect(0, str, nil);
fDDocWin.OffsetHintRect(mouse.CursorPos, Font.Size);
fDDocWin.ActivateHint(fDDocWin.HintRect, str);
fDDocWin.ActivateHint(fDDocWin.HintRect, str);
end;
end;
@ -575,11 +576,13 @@ begin
identifierToD2Syn;
if not (Shift = [ssCtrl]) then exit;
//
IncPaintLock;
case Key of
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_DECIMAL: Font.Size := fDefaultFontSize;
end;
DecPaintLock;
TCEEditorHintWindow.FontSize := Font.Size;
fCanShowHint:=false;
fDDocWin.Hide;
@ -617,18 +620,20 @@ end;
function TCESynMemo.getMouseFileBytePos: Integer;
var
i, len: Integer;
i, len, llen: Integer;
begin
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;
for i:= 0 to fMousePos.y-2 do
result += length(Lines.Strings[i]) + len;
result += fMousePos.x;
//getMessageDisplay.message(format('%d - %d : %d',[fMousePos.x, fMousePos.y, result]),nil,amcMisc,amkBub);
end;
procedure TCESynMemo.MouseMove(Shift: TShiftState; X, Y: Integer);