A very hacky implementation of the tab completion feature.