[question] how the peek-window implemented
jidibinlin opened this issue · 2 comments
Hi! Can you tell me which tech you used to implement the peek-window! Best for some implementation detail。Thankyou
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:
- The content of the window is completely determined by a set of internal states (variables).
citre-peek
commands update these states.citre-peek--update-display
recalculates the content of the window based on these states.
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.
@AmaiKinono Thankyou very must!