mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-07 11:16:07 +02:00
IDE, codetools, synedit: fixed identifier completion of identifiers prefixed with &.
git-svn-id: trunk@50323 -
This commit is contained in:
parent
1b7e95bd67
commit
fb69b8b59d
@ -1735,6 +1735,7 @@ var
|
|||||||
Value, CurLine: string;
|
Value, CurLine: string;
|
||||||
NewBlockBegin, NewBlockEnd: TPoint;
|
NewBlockBegin, NewBlockEnd: TPoint;
|
||||||
LogCaret: TPoint;
|
LogCaret: TPoint;
|
||||||
|
HighlighterIdentChars: TSynIdentChars;
|
||||||
begin
|
begin
|
||||||
//debugln('TSynCompletion.Validate ',dbgsName(Sender),' ',dbgs(Shift),' Position=',dbgs(Position));
|
//debugln('TSynCompletion.Validate ',dbgsName(Sender),' ',dbgs(Shift),' Position=',dbgs(Position));
|
||||||
F := Sender as TSynBaseCompletionForm;
|
F := Sender as TSynBaseCompletionForm;
|
||||||
@ -1744,11 +1745,17 @@ begin
|
|||||||
BeginUndoBlock{$IFDEF SynUndoDebugBeginEnd}('TSynCompletion.Validate'){$ENDIF};
|
BeginUndoBlock{$IFDEF SynUndoDebugBeginEnd}('TSynCompletion.Validate'){$ENDIF};
|
||||||
BeginUpdate;
|
BeginUpdate;
|
||||||
try
|
try
|
||||||
|
if Editor.Highlighter<>nil then
|
||||||
|
HighlighterIdentChars := Editor.Highlighter.IdentChars
|
||||||
|
else
|
||||||
|
HighlighterIdentChars := [];
|
||||||
LogCaret := LogicalCaretXY;
|
LogCaret := LogicalCaretXY;
|
||||||
NewBlockBegin:=LogCaret;
|
NewBlockBegin:=LogCaret;
|
||||||
CurLine:=Lines[NewBlockBegin.Y - 1];
|
CurLine:=Lines[NewBlockBegin.Y - 1];
|
||||||
while (NewBlockBegin.X>1) and (NewBlockBegin.X-1<=length(CurLine))
|
while (NewBlockBegin.X>1) and (NewBlockBegin.X-1<=length(CurLine))
|
||||||
and (IsIdentifierChar(@CurLine[NewBlockBegin.X-1])) do
|
and ((IsIdentifierChar(@CurLine[NewBlockBegin.X-1]))
|
||||||
|
or (CurLine[NewBlockBegin.X-1] in HighlighterIdentChars))
|
||||||
|
do
|
||||||
dec(NewBlockBegin.X);
|
dec(NewBlockBegin.X);
|
||||||
//BlockBegin:=NewBlockBegin;
|
//BlockBegin:=NewBlockBegin;
|
||||||
if ssShift in Shift then begin
|
if ssShift in Shift then begin
|
||||||
@ -1759,7 +1766,9 @@ begin
|
|||||||
NewBlockEnd := LogCaret;
|
NewBlockEnd := LogCaret;
|
||||||
CurLine:=Lines[NewBlockEnd.Y - 1];
|
CurLine:=Lines[NewBlockEnd.Y - 1];
|
||||||
while (NewBlockEnd.X<=length(CurLine))
|
while (NewBlockEnd.X<=length(CurLine))
|
||||||
and (IsIdentifierChar(@CurLine[NewBlockEnd.X])) do
|
and ((IsIdentifierChar(@CurLine[NewBlockEnd.X]))
|
||||||
|
or (CurLine[NewBlockEnd.X] in HighlighterIdentChars))
|
||||||
|
do
|
||||||
inc(NewBlockEnd.X);
|
inc(NewBlockEnd.X);
|
||||||
end;
|
end;
|
||||||
//debugln('TSynCompletion.Validate B Position=',dbgs(Position));
|
//debugln('TSynCompletion.Validate B Position=',dbgs(Position));
|
||||||
|
@ -4226,7 +4226,7 @@ end; { TSynPasSyn.UseUserSettings }
|
|||||||
|
|
||||||
function TSynPasSyn.GetIdentChars: TSynIdentChars;
|
function TSynPasSyn.GetIdentChars: TSynIdentChars;
|
||||||
begin
|
begin
|
||||||
Result := ['_', '0'..'9', 'a'..'z', 'A'..'Z'];
|
Result := ['&', '_', '0'..'9', 'a'..'z', 'A'..'Z'];
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class function TSynPasSyn.GetLanguageName: string;
|
class function TSynPasSyn.GetLanguageName: string;
|
||||||
|
@ -626,12 +626,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
//Add the '&' character to prefixed identifiers
|
//Add the '&' character to prefixed identifiers
|
||||||
if (iliNeedsAmpersand in IdentItem.Flags) and
|
if (iliNeedsAmpersand in IdentItem.Flags) then
|
||||||
//check if there is already an '&' in front of this atom
|
|
||||||
((IdentList.StartAtom.StartPos-1 > IdentList.StartContext.Tool.SrcLen) or //StartPos-1 is out-of-scope
|
|
||||||
(IdentList.StartAtom.StartPos-1 < 1) or //StartPos-1 is out-of-scope
|
|
||||||
(IdentList.StartContext.Tool.Src[IdentList.StartAtom.StartPos-1] <> '&')) //StartPos is in-scope and not &
|
|
||||||
then
|
|
||||||
Result := '&' + Result;
|
Result := '&' + Result;
|
||||||
|
|
||||||
case ValueType of
|
case ValueType of
|
||||||
|
Loading…
Reference in New Issue
Block a user