As far as I can tell, selection in Visual mode using most text objects results in the cursor being placed at the end of the text object region, whether that's linewise or characterwise.
However, using the same text object in Operator-pending mode results in the cursor being placed at the beginning of the text object region after the operation finishes.
For example, some Python code, with cursor indicated by │
:
print(123)
class Y:
def g(x│x, yy, zz):
return
print(456)
If I use gUip
, I get:
print(123)
│CLASS Y:
DEF G(XX, YY, ZZ):
RETURN
print(456)
But if I use ip
in Visual mode, I get:
print(123)
class Y: ← selected
def g(xx, yy, zz): ← selected
│ return ← selected
print(456)
In Operator-pending mode, the cursor goes to the beginning of the region. In Visual mode, the cursor goes to the end (linewise) of the region.
Is there a reason for this behavior? Historical? Technical? Is there more subtlety to it than I realize?