From 8d3220ad3db3de312da9a8a5c26754407547d3d2 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Wed, 21 Jan 2009 01:48:22 +0900 Subject: [PATCH] preserve text cursor when writing fields --- ankiqt/ui/facteditor.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ankiqt/ui/facteditor.py b/ankiqt/ui/facteditor.py index 48fe8567a..b640d9d2d 100644 --- a/ankiqt/ui/facteditor.py +++ b/ankiqt/ui/facteditor.py @@ -304,9 +304,11 @@ class FactEditor(object): self.widgets[w] = field new = self.fact[field.name] old = tidyHTML(unicode(w.toHtml())) - # only update if something has changed, to preserve the cursor + # only update if something has changed if new != old: + cur = w.textCursor() w.setHtml('' + new) + w.setTextCursor(cur) if font: # apply fonts font = QFont()