Maybe i named the variable <code>previousPrefix</code> wrong.After one autocompletion, the prefix entering the method is the next matched search query present in the historyBuffer.On pressing up or down again, I have to find the next matched query using the same short prefix used in the start (which I store in <code>previousPrefix</code>).Indirectly, I'm trying to figure out whether the value in the input is user entered or autocompleted using  this logic.