D29107: [KJotsEdit] Reimplement ancient (yet still relevant) workaround for QTextEdit

Igor Poboiko noreply at phabricator.kde.org
Thu Apr 23 11:59:29 BST 2020


poboiko added a comment.


  In D29107#655102 <https://phabricator.kde.org/D29107#655102>, @dfaure wrote:
  
  > You say "The format does not seem to exist before the first character" and yet that's exactly where you're moving the cursor.
  >  The code looks ok to me, but the comment is confusing/wrong.
  
  
  Fair point. I've just copied the comment from the old code, without much thinking about it.
  
  > It's just about setting the format of the cursor from the first char. I agree that it's probably a bug that setDocument doesn't trigger that, but I'm not sure the old bug report reference still makes sense here, it feels like a different issue to me (the comment and old workaround says "there's nothing at pos 0, go to pos 1 to grab the format"). Unrelated to your issue and fix.
  
  I think actually that the comment was about the same issue, but the author actually misinterpreted it. When we're going to pos 1 to grab the format, we are still grabbing it from the very first character and very first block in the document. The `moveCursor(Start)` does it too.
  
  ---
  
  This is freshly opened document without the patch (note the font size is 10 and bold is not marked, although the first symbol is of size 20 and is bold):
  F8255333: scr1.png <https://phabricator.kde.org/F8255333>
  This is what happens if I more cursor to the right (the cursor is not visible, but it's at pos 1, at it grabbed style from the first symbol: it's bold and of size 20. I can now freely move it back to the left, and the style will be preserved. That's the old workaround):
  F8255335: scr2.png <https://phabricator.kde.org/F8255335>
  And that's the screenshot with this patch (which doesn't move it to the pos 1, but to the start; the cursor is adjusted from the very beginning):
  F8255338: scr3.png <https://phabricator.kde.org/F8255338>

REPOSITORY
  R573 KJots

REVISION DETAIL
  https://phabricator.kde.org/D29107

To: poboiko, dvratil, dfaure
Cc: kde-pim, fbampaloukas, dcaliste, dvasin, rodsevich, winterz, vkrause, mlaurent, knauss, dvratil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20200423/5ba39410/attachment-0001.html>


More information about the kde-pim mailing list