improved tab completion

Previously the current command was only replaced if there was only one
possible completion left. Now if you have 2 similarly named files or
commands it will complete up the the furthest matching letter.