opened
t9md
username_0
I've been added many experimental, vmp original Motion, Operator, TextObject till now.
Sometime I'm confused for role of these essential building blocks.

e.g. LastSelection is really TextObject?, SearchMatchForward is really TextObject? or should I implment it as Motion??

So to clarify role of those object, I dumped my thought here.

# Operator

Do something on target

Something? yank, delete, upCase, increment number, add selection, select.
Most of something is **mutation** of text, but some operator not fall into this category such as select, add-selection.

Target? range of editor, range is defined by start and end position.

# Motion

Move cursor to new position

# TextObject

Return range regardless of cursor position(or be tolerant of cursor position).

# How to compose

Operator do something on range, range is specified by motion or operator.

Range specified by motion is range defined by start="initial cursor position", end="cursor position after moved"

# Motion / TextObject distinguish

No clear border, but here is the hint I use.

Motion can move continuously to forward or backward direction. 
TextObject is tolerant of current cursor position, so selected range include forward and backward direction of area of current cursor position.
[NOTE] Role of Operator, TextObject, Motion
issue
closed
t9md
username_0
issue