add OnProperty() for Navigator
Pull request
add property to control Navigator property name : _navigator : [right|left]by[char|syllable] , [left|right] [home|end] rewind move_by_syllable: [-num|num] -left | +right
Issue tracker
Fixes will automatically close the related issue
Fixes #
Feature
Describe feature of pull request
Unit test
- [ ] Done
Manual test
- [ ] Done
Code Review
- Unit and manual test pass
- GitHub Action CI pass
- At least one contributor reviews and votes
- Can be merged clean without conflicts
- PR will be merged by rebase upstream base
Additional Info
what you are proposing is a command, action or input, which is short-lived & one-off. It is neither appropriate nor feasible to represent an action by a property which stays unchanged for a long time or even permanently unchanged.
The logic of your codes inverts the causality: when you change the "property" of left_by_char to 3, then the cursor should move 3 characters to the left. But be aware, for every character to the left the cursor moves past, the "property" of left_by_char actually should attain 1 — and you shall find yourself in an infinite loop, should the code be really logically implemented, though that's not the case here.
Even if we pretend that property can be abused in this way, it really doesn't work. Try if you set left_by_char to 3, and after the cursor has moved 3 characters, you set left_by_char to 3 again, then nothing will happen because the property hasn't changed at all but you are forcing the static property to enforce a dynamic action.
Your intention can be easily implemented by key binding