Merge pull request #607 from Arthur-Milchior/remove_a_try

Simplify the copying of field contents when resetting
This commit is contained in:
Damien Elmes 2020-05-05 11:36:17 +10:00 committed by GitHub
commit 08f894735a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -121,14 +121,9 @@ class AddCards(QDialog):
if oldNote: if oldNote:
if not keep: if not keep:
self.removeTempNote(oldNote) self.removeTempNote(oldNote)
for n in range(len(note.fields)): for n in range(min(len(note.fields), len(oldNote.fields))):
try: if not keep or flds[n]["sticky"]:
if not keep or flds[n]["sticky"]: note.fields[n] = oldNote.fields[n]
note.fields[n] = oldNote.fields[n]
else:
note.fields[n] = ""
except IndexError:
break
self.setAndFocusNote(note) self.setAndFocusNote(note)
def removeTempNote(self, note: Note) -> None: def removeTempNote(self, note: Note) -> None: