<div dir="ltr"><div dir="ltr">On Fri, Jan 26, 2024 at 12:05 PM Charles <<a href="mailto:peacech@gmail.com" target="_blank">peacech@gmail.com</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div style="font-family:arial,helvetica,sans-serif;font-size:small">Hi,</div><div style="font-family:arial,helvetica,sans-serif;font-size:small"><br></div><div style="font-family:arial,helvetica,sans-serif;font-size:small">Other than Google and AI, searching code in github is also an alternative: searching for mergeCharFormat yields</div><div style="font-family:arial,helvetica,sans-serif;font-size:small"><br></div><div style="font-family:arial,helvetica,sans-serif;font-size:small"><a href="https://github.com/kovidgoyal/calibre/blob/07f988b109627bdbb88ab4b43ccfa6956276c682/src/calibre/gui2/comments_editor.py#L465" target="_blank">https://github.com/kovidgoyal/calibre/blob/07f988b109627bdbb88ab4b43ccfa6956276c682/src/calibre/gui2/comments_editor.py#L465</a></div><div style="font-family:arial,helvetica,sans-serif;font-size:small"><br></div><div style="font-family:arial,helvetica,sans-serif;font-size:small">From the look of it, your code is missing `self.textEditor.setTextCursor(...)` because `textCursor()` returns a copy.<br></div></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div></div></div></blockquote></div></blockquote><div><br></div><div>Hi Charles,</div><div><br></div><div>I gave that a try:</div><div><br></div><div>        cursor = self.textEditor.textCursor()<br>        cursor.setCharFormat(fmt)<br>        self.textEditor.setTextCursor(cursor)<br></div><div><br></div><div>Sadly, it did not change the behavior. Thanks for the reply, though!</div><div><br></div><div>Best,</div><div>Ovid</div></div></div>