Day 17: Printing and searching

After looking at a pull request adding a :print --pdf flag to directly print to PDF (and an accompanying test), I noticed I totally forgot to add printing support to the new tab API. This wasn't caught previously because there was no test for printing (as it's hard to use the print dialog programmatically).

I added some API for printing and fixed up the PR as well as the current printing code. Unfortunately real print support is still missing upstream in QtWebEngine, but :print --pdf should work with QtWebEngine with a (yet to be released) enough recent PyQt version.

The PDF printing test failed on Windows - the issue wasn't entirely obvious at first: Windows uses backslashes as path separators, but the qutebrowser commandline (which is also used by the end-to-end tests) uses that to escape quotes - I pushed a change to (almost) always escape backslashes in commands for the tests, which fixed that and didn't break anything else.

After that I took a look at the searching code, as that was probably what I missed the most when trying to use QtWebEngine in qutebrowser to browser documentation.

I had to restructure things quite a bit as much was handled inside qutebrowser's QWebView subclass, but now searching works with QtWebEngine as well - and it even shows the nice indicators on the scrollbar, like Chromium:

scroll bar while searching

I also ended up removing support for the setting general -> wrap-search, which now is always true. Only very few people seemed to change that setting, and QtWebEngine always wraps without a possibility to influence that.