IDE, codetools, synedit: fixed identifier completion of identifiers prefixed with &.

git-svn-id: trunk@50323 -
This commit is contained in:
ondrej 2015-11-12 17:01:27 +00:00
parent 1b7e95bd67
commit fb69b8b59d
3 changed files with 13 additions and 9 deletions

View File

@ -1735,6 +1735,7 @@ var
Value, CurLine: string;
NewBlockBegin, NewBlockEnd: TPoint;
LogCaret: TPoint;
HighlighterIdentChars: TSynIdentChars;
begin
//debugln('TSynCompletion.Validate ',dbgsName(Sender),' ',dbgs(Shift),' Position=',dbgs(Position));
F := Sender as TSynBaseCompletionForm;
@ -1744,11 +1745,17 @@ begin
BeginUndoBlock{$IFDEF SynUndoDebugBeginEnd}('TSynCompletion.Validate'){$ENDIF};
BeginUpdate;
try
if Editor.Highlighter<>nil then
HighlighterIdentChars := Editor.Highlighter.IdentChars
else
HighlighterIdentChars := [];
LogCaret := LogicalCaretXY;
NewBlockBegin:=LogCaret;
CurLine:=Lines[NewBlockBegin.Y - 1];
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);
//BlockBegin:=NewBlockBegin;
if ssShift in Shift then begin
@ -1759,7 +1766,9 @@ begin
NewBlockEnd := LogCaret;
CurLine:=Lines[NewBlockEnd.Y - 1];
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);
end;
//debugln('TSynCompletion.Validate B Position=',dbgs(Position));

View File

@ -4226,7 +4226,7 @@ end; { TSynPasSyn.UseUserSettings }
function TSynPasSyn.GetIdentChars: TSynIdentChars;
begin
Result := ['_', '0'..'9', 'a'..'z', 'A'..'Z'];
Result := ['&', '_', '0'..'9', 'a'..'z', 'A'..'Z'];
end;
class function TSynPasSyn.GetLanguageName: string;

View File

@ -626,12 +626,7 @@ begin
end;
//Add the '&' character to prefixed identifiers
if (iliNeedsAmpersand in IdentItem.Flags) and
//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
if (iliNeedsAmpersand in IdentItem.Flags) then
Result := '&' + Result;
case ValueType of