CurrentSelection should not modify existing selection #648

t9md opened this Issue Jan 8, 2017 · 2 comments


None yet

1 participant

t9md commented Jan 8, 2017 edited

Currently CurrentSelection(very important persuade motion) MODIFY existing selection based on visual-mode's wise.
Because of this some operation such as ctrl-v D or ctrl-v C is intentionally bypassing use of CurrentSelection.
But this is bad, if selection(CurrentSelection) is exists, it should be used as target is big rule to followed by all operator.

Fix strategy is just skip selection normalization and de-normalization before/after movement.
It's completely unnecessary since CurrentSelection never move cursor.

The root cause of #602 is this bug.
So will rewrite after fixing this bug.

t9md commented Jan 8, 2017

Confirmed both conceptually and debug print while running test spec.
When normalization is executed currently is two cases.

  • Select operator targeted to arbitrary Motion
    • This is motion command in visual-mode(e.g. j motion in v j keystroke)
  • Arbitrary Operator targeted to CurrentSelection motion.
    • This is operator command in visual-mode(e.g. d operation in v d keystroke)

For CurrentSelection target we don't need any selection modification so no normalization is required.
Now I'm re-understand normalization if for normalizing visual-mode's cursor position.

t9md commented Jan 8, 2017

Things are not such simple, I remember when I tried same cleanup before!!.

Normalization is not only for visual-mode motion, it also have role to record restore cursor position in consistent manner, that cursor position is recorded by mutationManager.
When vL mode we have to normalize selection to know the characterwise cursor position to restore.
For example V k y restore cursor to characterwise head of normalized selection range.

But I know I can cleanup this complex part further will continue investigation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment