If I can not find a definitive solution, I will try to contact the SynEdit maintainer and suggest this behavior - to respect the limits of the application screen) - as default.
That would be me... (with respect to the Lazarus fork)
Lazarus IDE uses the same synEdit component. However, in the IDE the check of boundaries of the screen is made somehow. Does anyone know how to circumvent the problem like in IDE?
Not exactly.
The SynEdit in Lazarus was forked more than a decade (probably more towards 2 decades) ago. It has since been independently developed.
There is a more recent port:
https://wiki.lazarus.freepascal.org/SynEdit#SynEdit_2.0_port(Also that page may have other valuable info... (logical/physical caret pos))
I have no idea how well that port is maintained....
In the IDE, file ide/SourceEditor.pp, line 124
TSourceEditCompletion=class(TSynCompletion)
I haven't checked it completely, but I think:
TSourceEditCompletion.ccComplete calls Manager.ActiveCompletionPlugin.Complete
And I have not tracked it any further.....
Anyway the point is, in the IDE the plugin does not check itself for the keypress. The IDE does in one of the "UserCommand" events of TSynEdit.
So the IDE can call TSynBaseCompletion.Execute with the desired coordinates.
You can do the same: Do not assign a keycombo to the Completion, instead hook the SynEdit event and call Execute yourself.