editor, fix a case where calltips were unfairly closed

e.g parens used to change op precedence
This commit is contained in:
Basile Burg 2016-09-17 12:01:24 +02:00
parent 7febec25fb
commit 4be099408e
No known key found for this signature in database
GPG Key ID: 1868039F415CB8CF
1 changed files with 13 additions and 7 deletions

View File

@ -1549,7 +1549,8 @@ begin
tk0 := fLexToks[i]; tk0 := fLexToks[i];
tk1 := fLexToks[i+1]; tk1 := fLexToks[i+1];
if (tk0^.offset+1 <= p) and (p < tk1^.offset+2) and if (tk0^.offset+1 <= p) and (p < tk1^.offset+2) and
(tk0^.kind in [ltkString, ltkComment]) then exit; (tk0^.kind in [ltkString, ltkComment]) then
exit;
end; end;
tk0 := fLexToks[fLexToks.Count-1]; tk0 := fLexToks[fLexToks.Count-1];
if (tk0^.offset+1 <= p) and (tk0^.kind <> ltkIllegal) then if (tk0^.offset+1 <= p) and (tk0^.kind <> ltkIllegal) then
@ -1564,7 +1565,8 @@ begin
tk0 := fLexToks[i]; tk0 := fLexToks[i];
tk1 := fLexToks[i+1]; tk1 := fLexToks[i+1];
if (tk0^.offset+1 <= p) and (p < tk1^.offset+2) and if (tk0^.offset+1 <= p) and (p < tk1^.offset+2) and
(tk0^.kind in [ltkChar, ltkComment]) then exit; (tk0^.kind in [ltkChar, ltkComment]) then
exit;
end; end;
tk0 := fLexToks[fLexToks.Count-1]; tk0 := fLexToks[fLexToks.Count-1];
if (tk0^.offset+1 <= p) and (tk0^.kind <> ltkIllegal) then if (tk0^.offset+1 <= p) and (tk0^.kind <> ltkIllegal) then
@ -1579,7 +1581,8 @@ begin
tk0 := fLexToks[i]; tk0 := fLexToks[i];
tk1 := fLexToks[i+1]; tk1 := fLexToks[i+1];
if (tk0^.offset+1 <= p) and (p < tk1^.offset+2) and if (tk0^.offset+1 <= p) and (p < tk1^.offset+2) and
(tk0^.kind = ltkComment) then exit; (tk0^.kind = ltkComment) then
exit;
end; end;
tk0 := fLexToks[fLexToks.Count-1]; tk0 := fLexToks[fLexToks.Count-1];
if (tk0^.offset+1 <= p) and (tk0^.kind <> ltkIllegal) then if (tk0^.offset+1 <= p) and (tk0^.kind <> ltkIllegal) then
@ -1706,7 +1709,7 @@ end;
procedure TCESynMemo.showCallTips(findOpenParen: boolean = true); procedure TCESynMemo.showCallTips(findOpenParen: boolean = true);
var var
str: string; str, lne: string;
i, x: integer; i, x: integer;
begin begin
if not fIsDSource and not alwaysAdvancedFeatures then if not fIsDSource and not alwaysAdvancedFeatures then
@ -1731,10 +1734,9 @@ begin
i -= 1; i -= 1;
end; end;
DcdWrapper.getCallTip(str); DcdWrapper.getCallTip(str);
if str.isNotEmpty then
begin begin
i := fCallTipStrings.Count; i := fCallTipStrings.Count;
if fCallTipStrings.Count <> 0 then if (fCallTipStrings.Count <> 0) and str.isNotEmpty then
fCallTipStrings.Insert(0, '---'); fCallTipStrings.Insert(0, '---');
fCallTipStrings.Insert(0, str); fCallTipStrings.Insert(0, str);
i := fCallTipStrings.Count - i; i := fCallTipStrings.Count - i;
@ -1742,7 +1744,11 @@ begin
{$PUSH}{$HINTS OFF}{$WARNINGS OFF} {$PUSH}{$HINTS OFF}{$WARNINGS OFF}
fCallTipStrings.Objects[0] := TObject(pointer(i)); fCallTipStrings.Objects[0] := TObject(pointer(i));
{$POP} {$POP}
str := fCallTipStrings.Text; str := '';
for lne in fCallTipStrings do
if lne.isNotEmpty then
str += lne + LineEnding;
str := str[1..str.length - length(LineEnding)];
{$IFDEF WINDOWS} {$IFDEF WINDOWS}
str := str[1..str.length-2]; str := str[1..str.length-2];
{$ELSE} {$ELSE}