+3

Delete word exhibits confusing behavior

flyingtabmow 9 years ago 0
Delete word (forwards or backwards) exhibits confusing and unpredictable behavior. From what I've gathered:

If there is a word immediately to the right of the cursor, and a space to the left (but only at most one), then "delete word backward" deletes the previous word and not the space preceding it.  If there is more than once space to the left of the cursor, it deletes the spaces until it reaches the previous word. If there is a word immediately to the left of the cursor, it deletes the word AND the space preceding the word (but only if there is exactly one space preceding the word... if there are more, it doesn't delete any spaces).

That is confusing.  I'm not sure whether this is a bug or "desired" behavior, but regardless, predicting the behavior of deleting a word shouldn't involve extensive thought about the current context of the cursor... it should delete the previous word on the screen (similar shenanigans take place when deleting a word forwards...).

At the very least, spaces before the word should never be deleted by "delete word backward", and spaces after the word should never be deleted by "delete word forward".