Hi everybody,
I'm about to design a Firebird management tools with lazarus, In Firebird there are system tables that starts with 'RDB$' and on code completion where I press $ to complete the word BOMB, The completion call Validate and first word on the list inserted on the editor!
Even I did some triks on line(11)
procedure TSynBaseCompletionForm.UTF8KeyPress(var UTF8Key: TUTF8Char);
begin
{$IFDEF VerboseKeys}
debugln('TSynBaseCompletionForm.UTF8KeyPress A UTF8Key="',DbgStr(UTF8Key),'" ',dbgsName(TObject(TMethod(OnUTF8KeyPress).Data)));
{$ENDIF}
if Assigned(OnUTF8KeyPress) then
OnUTF8KeyPress(Self, UTF8Key);
if UTF8Key='' then
exit;
//if UTF8Key=#8 then
if (UTF8Key=#8) or (UTF8Key = '$') then
begin
// backspace
end
else
if (Length(UTF8Key)>=1) and (not IsIdentifierChar(@UTF8Key[1])) then
begin
// non identifier character
// if it is special key then eat it
if (Length(UTF8Key) = 1) and (UTF8Key[1] < #32) then
begin
if Assigned(OnCancel) then
OnCancel(Self);
end
else
if Assigned(OnValidate) then
OnValidate(Self, UTF8Key, []);
UTF8Key := '';
end
else
if (UTF8Key<>'') then
begin
// identifier character
AddCharAtCursor(UTF8Key);
UTF8Key := '';
end;
{$IFDEF VerboseKeys}
debugln('TSynBaseCompletionForm.UTF8KeyPress END UTF8Key="',DbgStr(UTF8Key),'"');
{$ENDIF}
end;
That prevent closing the completion, another thing appears to me, Just in case:
rdb$ -> what typed before [CTRL+Space] to show completion list
And select 'RDB$DATABASE' from list and pressing the [Enter] key make result as line below:
rdb$RDB$DATABASE
Actually it must replace the currentword to what selected, like another case:
tbl_ -> what typed before [CTRL+Space] to show completion
And select 'TBL_DOCUMENT' from list and pressing the [Enter] key make result as line below:
TBL_DOCUMENT
It's seems $ key make the completion action like "EndOfTokenChr" of TSynCompletion.
Is there any way to describe the '$' key as a normal key for TSynCompletion?
----------------
I did this simple patch and everything works:
// ->lazarus/components/synedit/synhighlightersql.pas Line(1665)
//Lazarus 1.7 r52786M FPC 3.0.0 x86_64-linux-gtk 2
function TSynSQLSyn.GetIdentChars: TSynIdentChars;
begin
Result := TSynValidStringChars;
if (fDialect = sqlInterbase6) then ///Here solves the problem
Include(Result, '$');
if (fDialect = sqlMSSQL7) or (fDialect = sqlMSSQL2K) then
Include(Result, '@')
{begin} // DJLP 2000-08-11
else if fDialect = sqlOracle then begin
Include(Result, '#');
Include(Result, '$');
end;
{end} // DJLP 2000-08-11
end;