Fix the an annoying problem in completion in ipython mode

If there is no completion at the point, the whole input will be removed. This is
really annoying.