librime icon indicating copy to clipboard operation
librime copied to clipboard

add OnProperty() for Navigator

Open shewer opened this issue 2 years ago • 1 comments

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

  1. Unit and manual test pass
  2. GitHub Action CI pass
  3. At least one contributor reviews and votes
  4. Can be merged clean without conflicts
  5. PR will be merged by rebase upstream base

Additional Info

shewer avatar Mar 12 '23 00:03 shewer

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

groverlynn avatar Oct 06 '23 20:10 groverlynn