Open jidanni opened 3 years ago
OK,
bind 'set skip-completed-text on'
fixes example 4 and 5, and at least doesn't seem to make anything else worse.
skip-completed-text (Off)
If set to On, this alters the default completion behavior when
inserting a single match into the line. It's only active when
performing completion in the middle of a word. If enabled,
readline does not insert characters from the completion that
match characters after point in the word being completed, so
portions of the word following the cursor are not duplicated.
Then why isn't "on" the default? (OK, I will ask bug-bash.)
Today let's explore some cases of when the cursor is within a word, and we hit TAB. We will use
[ ]
to indicated what character the cursor is on. We will randomly choose some commands here, (sys..., find), to test. But this bug report applies much wider. (Actually the sys... example isn't too good, as it highly depends on the state of your system.)Example 1:
(Hitting TAB flashes the screen / beeps.) (Bad.)
Example 2:
Excellent. However in Example 1, couldn't the space been added for us?
Example 3:
Hmmmm.
Example 4:
That's right. We are now looking at
(with the cursor still sitting on the final "o".) (Hitting RET no will of course send the trailing junk to the program.)
Anyway, I hope through these examples I have illustrated that although bash-completions works great when the cursor is at the end of the (last) word, they don't work so great when the cursor is in the middle of words.
Wait, here's one more. Example 5:
(Hey, didn't you see the 'p' at the end?!)