Set to remember the last replace input for findreplace.ui
https://anki.tenderapp.com/discussions/ankidesktop/39468-find-and-replace-does-not-remember-the-input-from-last-time
This commit is contained in:
parent
ba99c5ecb5
commit
3971ea5518
@ -1936,6 +1936,11 @@ update cards set usn=?, mod=?, did=? where id in """
|
||||
frm.find.lineEdit().selectAll()
|
||||
frm.find.setFocus()
|
||||
|
||||
replacehistory = self.mw.pm.profile.get("FindAndReplaceReplaceHistory", [])
|
||||
frm.replace.addItems(replacehistory)
|
||||
frm.replace.lineEdit().setText(replacehistory[0] if replacehistory else "")
|
||||
frm.replace.lineEdit().selectAll()
|
||||
|
||||
frm.field.addItems([_("All Fields")] + fields)
|
||||
qconnect(frm.buttonBox.helpRequested, self.onFindReplaceHelp)
|
||||
restoreGeom(d, "findreplace")
|
||||
@ -1957,7 +1962,15 @@ update cards set usn=?, mod=?, did=? where id in """
|
||||
frm.find.addItems(findhistory)
|
||||
self.mw.pm.profile["FindAndReplaceFindHistory"] = findhistory
|
||||
|
||||
replace = frm.replace.text()
|
||||
replace = frm.replace.lineEdit().text()
|
||||
if replace in replacehistory:
|
||||
replacehistory.remove(replace)
|
||||
replacehistory.insert(0, replace)
|
||||
replacehistory = replacehistory[:30]
|
||||
frm.replace.clear()
|
||||
frm.replace.addItems(replacehistory)
|
||||
self.mw.pm.profile["FindAndReplaceReplaceHistory"] = replacehistory
|
||||
|
||||
regex = frm.re.isChecked()
|
||||
nocase = frm.ignoreCase.isChecked()
|
||||
|
||||
|
@ -47,7 +47,20 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="replace"/>
|
||||
<widget class="QComboBox" name="replace">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>9</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="insertPolicy">
|
||||
<enum>QComboBox::NoInsert</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
|
Loading…
Reference in New Issue
Block a user