Fixes two things:
1. Cursor positions are being incorrectly calculated in scenarios where keystroke actions reject some input text.
2. Undo/redo operations were buggy and the commands would not merge often leading to single character undo/redo most of the times.
Currently event.change evaluates from first point of difference to end of the string. This MR modifies it to evaluate to whole incoming text. Now we evaluate whatever change is coming in, even if that change contains some common substring with original string (not considering only from the first point of difference).
The current definition makes it difficult to evaluate the final value from event.value and event.change within Javascript. This change is also better from compatibility POV as other readers such as Adobe and PDF.js make similar calculations.
Previously the `<del>` tag that Discount emits would be removed by Qt
since it's not in the subset of HTML that it understands. It does know
about `<s>` though, so replace `<del>` with `<s>` to render strikethroughs
correctly.
Note that I couldn't get Okular to build locally (PEBCAK issue) so I split out this file to debug it. I've tested against http://daringfireball.net/projects/downloads/MarkdownTest_1.0.zip and ff866f73d4/tests/data and the only difference is that trailing whitespace is now trimmed from the end of a line:
```diff
8c8
< <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Dashes:</p>
---
> <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Dashes: </p>
```
A quick search suggests this isn't a problem though https://stackoverflow.com/a/27026403:
> Within block tags (i.e. `<p>`, `<h1>`, `<div>`, ...) spaces as well as line breaks at the beginning or end of the tags should always be ignored (i.e. `<p>test</p>` should look the same as `<p> test </p>`).
I also tried https://doc.qt.io/qt-5/qtextdocument.html#setMarkdown which solves the strikethrough problem, though there are many visible differences with that approach. Most notably, everything is squashed together and code blocks lose their formatting.
In qt6, QRect::normalized changed it's meaning and it now has a 'span'
that preserves the old meaning.
Use the old span to get the old version of normalized so we can match on
the corners once again.
see https://codereview.qt-project.org/c/qt/qtbase/+/309932 for details.
BUG: 482249
After trying to measure the effect of switching TinyTextEntity from a
custom SBO string type to just QString and getting a barely measurable
gain, TinyTextEntity kind of looked like TextEntity, so merge those two.
Also reduce the amount of new/deletes around TextEntities
Implement a string pool for some tiny strings, and various memory optimizations
We now definitely has std::as_const available and Qt has started nagging
about converting to std::as_const.
Implementation is the same for both functions, and qAsConst was a
stop-gap measure until std::as_const was sufficiently available.
When signing a "filename versioned" pdf, e.g. foo-1.2.3.pdf, the
current suggestion for signed name is weird. the "_signed"
gets misplaced in the middle of the version.
Also, compressed pdf's (pdf.gz) gets up with weird suggestions.
Fix both of these cases and document (by tests) the current behavior.
In certain usecases, especially for non-linux desktop builds, the
advantage of of dbus is often limited. Provide a way to disable
building with dbus.
Note that this also disables the related functionalities of having a
second okular launch open the document in the first okular.
This also disables the unit tests that tests those features.
This adds a test document with most formatting options directly accessible through acrobat.
Currently only the number format functions are tested as they are the only ones implemented.
Original patch is from Oliver Sander, rebased and fixed up by Nicolas Fella
This is an abi break, but it menas we can extend signature and
certificate info in the future without breaking the abi again.
While we are at it, there is no need to hand around pointers to
certificate/signature info any longer, so clean up that. Fix memleaks as
side effect.
When the second instance is launched it receives an activation token per environment variable
We need to pass that token to the first instance so that it can use it to raise itself
Also properly use startup ids for this on X11 instead of relying on forceActiveWindow, which is a hack
This represents the newly entered data for each keystroke. This is often a single added character, but for cases like pasting text it can be more complex.
The PDF API reference doesn't specify any algorithm to use.
The algorithm used here works by iterating through both strings from the start until the first different character is encountered. Then the rest of the new text is considered the difference.
This doesn't produce the theoretically optimal/minimal diff, but seems to work well enough for practical application.
When text is removed the diff is empty
Better enforce them now, so that the work to port doesn't increase over
time
Not a super fan of this for regular applications, but oh well the ship
has sailed
If an image URL contains a non-ASCII character (e.g. `kartöffelchen.jpg`), the html returned by the markdown parser contains the encoded path `kart%C3%B6ffelchen.jpg`. We must decode the path before checking if the image file exists.