mirror of
https://github.com/anomalyco/opentui.git
synced 2026-04-24 20:45:56 +03:00
[PR #653] feat(extmarks): add onEncounter and onDeletion hooks for virtual extmarks #689
Labels
No labels
bug
core
documentation
feature
good first issue
help wanted
pull-request
question
react
solid
tmux
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/opentui#689
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/anomalyco/opentui/pull/653
Author: @jorgeraad
Created: 2/9/2026
Status: 🔄 Open
Base:
main← Head:feat/extmark-encounter-hooks📝 Commits (7)
3d38523feat(extmarks): add encounter hook interfaces and callback storagee8dd776feat(extmarks): wire callback maps to extmark lifecycledf0af4ffeat(extmarks): add onEncounter hooks to cursor movement methods2cbec55feat(extmarks): add onDeletion hooks to deletion methods8e02a45test(extmarks): add tests for onEncounter and onDeletion hooks3ebfe22feat(extmarks): add select-then-act interaction to extmarks democ2ef3e4style: format extmarks files with prettier📊 Changes
3 files changed (+732 additions, -41 deletions)
View changed files
📝
packages/core/src/examples/extmarks-demo.ts(+177 -41)📝
packages/core/src/lib/extmarks.test.ts(+443 -0)📝
packages/core/src/lib/extmarks.ts(+112 -0)📄 Description
Closes #652
Summary
Adds per-extmark
onEncounterandonDeletioncallbacks toExtmarkOptions, letting consumerscontrol what happens when the cursor hits a virtual extmark or the user tries to delete one.
Changes
Core hooks (
packages/core/src/lib/extmarks.ts):ExtmarkEncounterandExtmarkDeletionEncounterinterfaces with action methods (skip(),setCursor(),deleteExtmark(),prevent())onEncounterandonDeletionoptional fields onExtmarkOptionsmetadatamap, cleaned up indelete()andclear()onEncounterwired into all 5 wrapped cursor methods (left, right, up, down, setCursorByOffset)onDeletionwired intodeleteCharBackwardanddeleteCharDemo (
packages/core/src/examples/extmarks-demo.ts):press Enter to expand it, Backspace to delete it, or arrow again to skip past
Demo
https://drive.google.com/file/d/1w83taLW36FnsmEeZGCj-49q9H00FuN12/view?usp=sharing
Backwards compatibility
Fully backwards compatible. Omitting
onEncounter/onDeletionpreserves existing skip and delete behavior unchanged.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.