Replace large comprehension with much simpler code; fix comment to reference maxSize instead of previous 10KB limit; only pop a history entry if the file size is actually bigger than maxSize; only add items to the history if they are different from the last item by storing the last line and loading it on startup.
Move lastLine setter into conditional block to prevent .commands and blank lines from setting lastLine
Merge pull request #2914 from danielgtaylor/repl-history

repl history implementation improvements