Skip to content
  • Igor Poboiko's avatar
    Grab character format after the link if cursor points at its end · 7c49e82b
    Igor Poboiko authored and Laurent Montel's avatar Laurent Montel committed
    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).
    7c49e82b