[Qt] Improve rpc console history behavior

The current behavior of the history in rpcconsole with the up and down keys is a little bit annoying,
because entries are unexpectedly removed from the history.

I compared the behavior after this patch with my local bash and it seems to be the same.