Set cursor part correctly if the cursor is at the end.
Split commands with split=False correctly.

Fixes #231.
Add additional split test with flags.
Strip pattern when completing.