meow-edit / meow

Yet another modal editing on Emacs / 猫态编辑
GNU General Public License v3.0
1.07k stars 128 forks source link

meow-back-symbol should not unconditionally reverse direction #546

Closed politza closed 3 months ago

politza commented 3 months ago

Hey, great package !

In https://github.com/meow-edit/meow/blob/3247b9d4f2b46bcf8d216857a59d67dd416dcdb9/meow-command.el#L894 the direction is set to backward unconditionally.

This line is missing in the very similar implementation of meow-back-word: https://github.com/meow-edit/meow/blob/3247b9d4f2b46bcf8d216857a59d67dd416dcdb9/meow-command.el#L873 .

As a result those motions are inconsistent. Moving backwards with meow-back-symbol moves to far, i.e. at the end of a selected symbol, it moves to the beginning of the previous one.

DogLooksGood commented 3 months ago

That's expected behavior, it depends on current selection type. When you have an expanding word selection, the word commands simply expand the selection.

https://github.com/meow-edit/meow/blob/master/EXPLANATION.org#selection

Haxxflaxx commented 3 months ago

I don't see why a consistent behavior between meow-back-word and meow-back-symbol isn't desired. When I encountered this I assumed it was a bug.

DogLooksGood commented 3 months ago

@Haxxflaxx They should be consistent, what you encountered?

Haxxflaxx commented 3 months ago

The easiest way of seeing it is by navigating from the middle of a word. Lets illustrate this with '|' as point and '<' as mark. Looking at "first sec|ond third". Calling meow-next-word and meow-next-symbol has the same result: "first sec<ond| third".

Then calling meow-back-word will result in: "first |second< third".

But calling meow-back-symbol will result in: "first |sec<ond third".

You can also see the strange behavior which I think @politza is referring to if you start at the beginning of a word: "first |second third" after meow-next-symbol: "first <second| third", after meow-back-symbol: "|first <second third"

DogLooksGood commented 3 months ago

Sorry for I didn't understand the issue in the first place.

@politza @Haxxflaxx Thanks for the report and explanation!

Fixed dabfaaa