When calling (tp-set str 'layer-name), the layer name symbol was wrapped
in a list by tp--parse-args. tp--resolve-props then incorrectly treated
this single-element list as a plist and generated an anonymous tp-anon-X
name instead of using the actual layer name.
The fix adds detection in tp--resolve-props for single-element lists
containing a defined layer/group name symbol, and correctly resolves
them by recursing with just the symbol.
Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>
1. When using setq-local, only update the current buffer
2. When using setq, update all buffers that have the text property
Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>
- Add tp--generate-anonymous-layer-name to create unique layer names (tp-anon-*)
- Update tp--resolve-props to handle anonymous plists:
- If plist has reactive variables ($...), generate tp-name and register dependencies
- All anonymous plists now get a tp-name for reactive support
- Update tp--parse-args to process all props through tp--resolve-props
- Update tp--ensure-props to handle plists with reactive variables
- Add tests for anonymous reactive layers with tp-set, tp-match-set, tp-regexp-set
Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>
- tp--resolve-props now uses tp-layer-props (includes tp-name) for layers
- For groups, uses tp--build-layer-props to include tp-layers structure
- Updated tests to verify tp-name and tp-layers are preserved
- Added new test for groups with multiple layers
Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>
- Add tp--ensure-props helper to reduce code duplication
- Add nil check for group's first layer in tp--resolve-props
- Improve comments in tp--parse-args to explain the unwrapping logic
Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>
- Add tp--resolve-props helper function to resolve layer/group names to property lists
- Modify tp--parse-args to handle layer name symbols for tp-set, tp-reset, tp-add
- Update tp-match-set, tp-match-reset, tp-match-add to accept layer names
- Update tp-regexp-set, tp-regexp-reset, tp-regexp-add to accept layer names
- Update docstrings to document the new functionality
- Add comprehensive tests for all affected functions
Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>
- Updated tp-search-map signature to (function property &optional value object start end)
- Updated tp-forward-do signature to (function property &optional value object times start end)
- Updated tp-backward-do signature to (function property &optional value object times start end)
- Function callback for tp-search-map now accepts (text &optional start end idx)
- Function callback for tp-forward-do/tp-backward-do now accepts (text &optional start end)
- Updated internal helper functions tp--search-do, tp--forward-do, tp--backward-do
- Added new tests for the updated APIs
- Updated documentation in README.md and README_CN.md with examples
Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>
Remove erroneous `t` predicate argument from tp-search-forward calls
that caused text-property-search-forward to find regions where the
property value CHANGES rather than regions where the property is SET.
Fixes issue: tp-forward-do / tp-backward-do 只在最后一次执行 function
Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>