TAdvMemo / TDBAdvMemo - Parameter Hint causes severe editor lag during cursor movement

When the OnGetParameterHint event returns a non-empty AParameterHint string and the parameter hint popup is visible, cursor movement inside parentheses becomes extremely slow (arrow keys, typing).

Steps to reproduce:

  1. Set AutoHintParameterPosition = hpBelowCode
  2. Implement OnGetParameterHint with Handled := True and return a valid hint string
  3. Type a function call, e.g. MyFunction(param1, param2, param3)
  4. Move the cursor inside the parentheses using arrow keys

Expected: Smooth cursor navigation, same as without hint popup
Actual: Noticeable lag on every keystroke/cursor move. The event fires on every single cursor position change, and each call triggers a full popup repaint.

Analysis:
Even with a trivially fast handler (single cached string comparison, no computation), the lag persists. Setting AParameterHint := '' (no popup shown) makes the editor fast again, confirming the popup rendering is the bottleneck — not the event handler itself.

Environment: TDBAdvMemo, Delphi 13 (Athens), Win32, TMS Component Pack 12.x

Suggestion: Consider skipping the popup repaint when the hint text has not changed since the last call, or throttle the repaint frequency internally.

Additional issue: The parameter hint popup disappears when the cursor is positioned after an opening parenthesis inside a string parameter.

Steps to reproduce:

  1. Have a function with parameter hint: MyFunction(p1:string; p2:integer; p3:string)
  2. Type: MyFunction('some text(', 123, 'other')
  3. Move the cursor inside the string literal after the ( character

Expected: The parameter hint popup remains visible, since the ( is inside a string literal and not a function call Actual: The hint popup disappears because the component interprets the ( as a new function call context, without considering string literal boundaries

Is it slow processing in your OnGetParameterHint() handler that might be causing this?
We retested this here with the code:

procedure TForm1.AdvMemo1GetParameterHint(Sender: TObject; AToken: string;
  var AParameterHint: string; var Handled: Boolean);
begin
  AParameterHint := 'var i: integer;var j: integer;var s: string';
  Handled := true;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  AdvMemo1.AutoHintParameterPosition := hpBelowCode;
  AdvMemo1.Lines.Add('procedure Test(param1,param2,param3);');
end;

but could not notice slowness?

advmemoparamhint

Good morning Bruno,

I have registered the full signature of a procedure/function in Autocomplete, for example:

function mytestfunction(vparam1: string; vP2: integer; vparam3: string): integer;

Later in the editor, I write/use it like this:

result := mytestfunction('1111111aaaa', 10, 'bbbbb(22222');

Two issues can be observed:

  1. When moving the cursor inside the parameter brackets, the editor becomes noticeably slow.

  2. If the cursor is moved within the parameters (e.g. around the second parameter), the parameter hint disappears after the opening parenthesis.

  3. possible that the slowness has to do with too much added entries in the autocomplete list? (i have >300 entries)