Bug 1071631 - fix findbar re-filling in last character, r=mikedeboer
--- a/toolkit/content/widgets/findbar.xml
+++ b/toolkit/content/widgets/findbar.xml
@@ -69,16 +69,24 @@
// We should do nothing during composition. E.g., composing string
// before converting may matches a forward word of expected word.
// After that, even if user converts the composition string to the
// expected word, it may find second or later searching word in the
// document.
if (this.findbar._isIMEComposing) {
return;
}
+
+ if (this._hadValue && !this.value) {
+ this._willfullyDeleted = true;
+ this._hadValue = false;
+ } else if (this.value.trim()) {
+ this._hadValue = true;
+ this._willfullyDeleted = false;
+ }
this.findbar._find(this.value);
]]></handler>
<handler event="keypress"><![CDATA[
let shouldHandle = !event.altKey && !event.ctrlKey &&
!event.metaKey && !event.shiftKey;
switch (event.keyCode) {
@@ -1096,18 +1104,20 @@
let prefsvc =
Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
const kPref = "accessibility.typeaheadfind.prefillwithselection";
if (this.prefillWithSelection && prefsvc.getBoolPref(kPref))
return;
let clipboardSearchString = this._browser.finder.clipboardSearchString;
- if (clipboardSearchString && this._findField.value != clipboardSearchString) {
+ if (clipboardSearchString && this._findField.value != clipboardSearchString &&
+ !this._findField._willfullyDeleted) {
this._findField.value = clipboardSearchString;
+ this._findField._hadValue = true;
// Changing the search string makes the previous status invalid, so
// we better clear it here.
this._updateStatusUI();
}
]]></body>
</method>
#endif