universal-ctags / citre

A superior code reading & auto-completion tool with pluggable backends.
GNU General Public License v3.0
320 stars 26 forks source link

[question] how the peek-window implemented #133

Closed jidibinlin closed 1 year ago

jidibinlin commented 1 year ago

Hi! Can you tell me which tech you used to implement the peek-window! Best for some implementation detail。Thankyou

AmaiKinono commented 1 year ago

The peek window is an overlay (citre-peek--ov). See citre-peek--mode to know how it's created.

Overlays has an after-string property. The content of the window is written to this property. See citre-peek--update-display.

citre-peek--update-display is added to post-command-hook (and is removed by citre-peek-abort) so the content is updated after every command. This is much like an immediate mode UI:

We do have an optimization: citre-peek--content-update is t only after a citre-peek command, so if it's nil, we only update the position of the overlay and leave its content untouched.

For details you need to read the code.

jidibinlin commented 1 year ago

@AmaiKinono Thankyou very must!