Skip to content
Commit 7c49e82b authored by Igor Poboiko's avatar Igor Poboiko Committed by Laurent Montel
Browse files

Grab character format after the link if cursor points at its end

The default QTextEdit behavior is following:
 - the current char format corresponds to the symbol right _before_ the cursor position.
 - if the cursor is at the start of the block, the format is grabbed from the symbol _after_ the cursor.

It works well with standard formatting (bold, underline, etc), which can easily be enabled / disabled using corresponding QActions.
Note that the behavior is also the same for, say, LibreOffice.

However, it does not work well with hyperlinks. If the document ends with a link, it is virtually impossible
to start typing normal text right after this link (i.e. to reset the char format). The only way to do it
is to use copy-paste (i.e. paste some normal text, preserving formatting), which is quite frustrating.

For the same reason it's not easy to write some text right after hyperlink.
I believe it's the reason behind this tiny whitespace in `insertHtml` inside richTextComposer.

The workaround is following: alter the default behiour and take the character format from symbol right _after_
the link if the cursor points at the end of the link (this is also the way LibreOffice behaves).
parent 7e64f50f
Pipeline #28940 passed with stage
in 13 minutes and 40 seconds
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment