mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-09 03:48:08 +02:00
IDE+codetools: ExtractOperand: added WithoutTrailingPoints
git-svn-id: trunk@21985 -
This commit is contained in:
parent
1803fc05ff
commit
1ffd720917
@ -464,7 +464,8 @@ type
|
||||
function ReplaceCode(Code: TCodeBuffer; StartX, StartY: integer;
|
||||
EndX, EndY: integer; const NewCode: string): boolean;
|
||||
function ExtractOperand(Code: TCodeBuffer; X,Y: integer;
|
||||
out Operand: string; WithPostTokens, WithAsOperator: boolean): boolean;
|
||||
out Operand: string; WithPostTokens, WithAsOperator,
|
||||
WithoutTrailingPoints: boolean): boolean;
|
||||
|
||||
// code completion = auto class completion, auto forward proc completion,
|
||||
// local var assignment completion, event assignment completion
|
||||
@ -2540,7 +2541,8 @@ begin
|
||||
end;
|
||||
|
||||
function TCodeToolManager.ExtractOperand(Code: TCodeBuffer; X, Y: integer; out
|
||||
Operand: string; WithPostTokens, WithAsOperator: boolean): boolean;
|
||||
Operand: string; WithPostTokens, WithAsOperator,
|
||||
WithoutTrailingPoints: boolean): boolean;
|
||||
var
|
||||
CursorPos: TCodeXYPosition;
|
||||
begin
|
||||
@ -2555,7 +2557,7 @@ begin
|
||||
CursorPos.Code:=Code;
|
||||
try
|
||||
Result:=FCurCodeTool.ExtractOperand(CursorPos,Operand,
|
||||
WithPostTokens,WithAsOperator);
|
||||
WithPostTokens,WithAsOperator,WithoutTrailingPoints);
|
||||
except
|
||||
on e: Exception do HandleException(e);
|
||||
end;
|
||||
|
@ -256,7 +256,8 @@ type
|
||||
function GetStringConstAsFormatString(StartPos, EndPos: integer;
|
||||
out FormatStringConstant, FormatParameters: string): boolean;
|
||||
function ExtractOperand(const CursorPos: TCodeXYPosition;
|
||||
out Operand: string; WithPostTokens, WithAsOperator: boolean): boolean;
|
||||
out Operand: string; WithPostTokens, WithAsOperator,
|
||||
WithoutTrailingPoints: boolean): boolean;
|
||||
|
||||
// resource strings
|
||||
function GatherResourceStringSections(const CursorPos: TCodeXYPosition;
|
||||
@ -3496,7 +3497,8 @@ begin
|
||||
end;
|
||||
|
||||
function TStandardCodeTool.ExtractOperand(const CursorPos: TCodeXYPosition; out
|
||||
Operand: string; WithPostTokens, WithAsOperator: boolean): boolean;
|
||||
Operand: string; WithPostTokens, WithAsOperator,
|
||||
WithoutTrailingPoints: boolean): boolean;
|
||||
var
|
||||
CleanPos: integer;
|
||||
StartPos: LongInt;
|
||||
@ -3521,6 +3523,10 @@ begin
|
||||
if EndPos<1 then exit;
|
||||
DebugLn(['TStandardCodeTool.ExtractOperand "',dbgstr(copy(Src,StartPos,EndPOs-StartPos)),'"']);
|
||||
Operand:=ExtractCode(StartPos,EndPos,[phpCommentsToSpace]);
|
||||
if WithoutTrailingPoints then begin
|
||||
while (Operand<>'') and (Operand[length(Operand)]='.') do
|
||||
Operand:=copy(Operand,1,length(Operand)-1);
|
||||
end;
|
||||
Result:=true;
|
||||
end;
|
||||
|
||||
|
@ -3287,7 +3287,7 @@ end;
|
||||
function TSourceEditor.GetOperandFromCaret(const ACaretPos: TPoint): String;
|
||||
begin
|
||||
if not CodeToolBoss.ExtractOperand(CodeBuffer, ACaretPos.X, ACaretPos.Y,
|
||||
Result, False, False)
|
||||
Result, False, False, true)
|
||||
then
|
||||
Result := GetWordFromCaret(ACaretPos);
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user