A worker thread works in practice, but the GIL takes a significant toll
as the code is computationally heavy. The result is a hogged UI,
specially when other threads are involved (eg. stats counter).
A worker process is faster, hogs the UI significantly less, at the cost
of slightly higher memory usage.
As side-effects:
- UberWriter can now comfortably handle much larger documents
- Text selection is much more responsive
A worker thread works in practice, but the GIL takes a significant toll
as the code is computationally heavy. The result is a hogged UI,
specially when other threads are involved (eg. markup handler).
A worker process is faster, hogs the UI significantly less, at the cost
of slightly higher memory usage.
Deferring to Pandoc is not without its faults. It still requires
processing (eg. horizontal rules turning into 72 dashes). It is
significantly slower and resource hungry.
On the reverse, the markup regexps have improved over time and are able
to handle the task.
Includes:
* Moving them into an independent file
* Using named groups for clarity
* Support for multi-line list items
* Better handling of block markup at start / end of document (eg. hr)
* Better handling of the separation around block items (eg. space around a list)
MathJax loads asynchronously and can alter the height of the document.
Altering the height alters the scroll.
Ensure MathJax is either unused or finished loading before reading
scroll from the preview.
Typing while in preview mode would occasionally lead to a scrolling
glitch, where scroll would briefly be at 0, before jumping to the
location it was supposed to be in in the first case.
This happened due to the async nature of JS calls, in the following
scenario:
1. Load
2. Read started
3. Read finished
4. Read started
5. Load
6. Read finished
The results from op 4 would be invalid due to loading in-between, and
handling the result in 6 would set the wrong scroll value.
This change ensures results are discarded whenever we are waiting for
them and a new load starts.
`path_to_file`'s argument is an absolute path, which already contains a leading `/`. Having an additional slash (ie. `file:////some/path`) actually breaks things, eg. the export flow using local assets.