SIGN IN SIGN UP

Refactoring of history code.

- Fix race condition in ThreadedHistory. Fixes issue #1158.
- Refactored the history code so that asynchronous history loader
  implementations become possible.
- Start loading the history when the `BufferControl` renders for the first
  time. This way we are sure that the history loading uses the same event loop
  as the one used by the application. (Important for tools like ptpython where
  the `Application` can run in a different thread.)
- Added unit tests.
- Make it possible to wrap `InMemoryHistory` in `ThreadedHistory` (not that
  useful, but good if all combinations work).
- Use a deque for the working lines in buffer.py -> much better performance
  when reloading the history.

Special thanks to "Bob Hyman <bob.hyman@gmail.com>" for the original
implementations of an improved history and script for reproducing issue #1158.
J
Jonathan Slenders committed
3394f5146a135681cc0718be71a65a67d65144ee
Parent: 298c3d9