From 197230e6cceb72e12bc23ce299570d6f37056bc7 Mon Sep 17 00:00:00 2001 From: "aaronl%netscape.com" Date: Thu, 22 Aug 2002 22:28:44 +0000 Subject: [PATCH] Bug 163905. [typeaheadfind] F3 hangs browser after selection returns to normal color. r=kyle, sr=alecf. Bug 163913: [typeaheadfind] status messages no longer displayed. r=kyle, sr=alecf --- .../resources/content/contents.rdf | 19 +++++++++++++ extensions/typeaheadfind/resources/jar.mn | 1 + .../resources/locale/en-US/contents.rdf | 7 +++-- .../typeaheadfind/src/nsTypeAheadFind.cpp | 28 +++++++++++++------ 4 files changed, 45 insertions(+), 10 deletions(-) create mode 100644 extensions/typeaheadfind/resources/content/contents.rdf diff --git a/extensions/typeaheadfind/resources/content/contents.rdf b/extensions/typeaheadfind/resources/content/contents.rdf new file mode 100644 index 00000000000..9a8358a3b1b --- /dev/null +++ b/extensions/typeaheadfind/resources/content/contents.rdf @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + diff --git a/extensions/typeaheadfind/resources/jar.mn b/extensions/typeaheadfind/resources/jar.mn index 52f512eb246..a858982fa20 100644 --- a/extensions/typeaheadfind/resources/jar.mn +++ b/extensions/typeaheadfind/resources/jar.mn @@ -1,4 +1,5 @@ typeaheadfind.jar: locale/en-US/typeaheadfind/contents.rdf (locale/en-US/contents.rdf) locale/en-US/typeaheadfind/typeaheadfind.properties (locale/en-US/typeaheadfind.properties) + content/typeaheadfind/contents.rdf (content/contents.rdf) diff --git a/extensions/typeaheadfind/resources/locale/en-US/contents.rdf b/extensions/typeaheadfind/resources/locale/en-US/contents.rdf index ad5ce3f72cd..921076e27e0 100644 --- a/extensions/typeaheadfind/resources/locale/en-US/contents.rdf +++ b/extensions/typeaheadfind/resources/locale/en-US/contents.rdf @@ -8,7 +8,10 @@ - + @@ -16,6 +19,6 @@ + chrome:localeVersion="1.1b"/> diff --git a/extensions/typeaheadfind/src/nsTypeAheadFind.cpp b/extensions/typeaheadfind/src/nsTypeAheadFind.cpp index 906a6fed2c2..2532583598c 100644 --- a/extensions/typeaheadfind/src/nsTypeAheadFind.cpp +++ b/extensions/typeaheadfind/src/nsTypeAheadFind.cpp @@ -842,23 +842,32 @@ nsTypeAheadFind::KeyPress(nsIDOMEvent* aEvent) // ----- Nothing found ----- DisplayStatus(PR_FALSE, nsnull, PR_FALSE); // Display failure status - nsCOMPtr soundInterface = - do_CreateInstance("@mozilla.org/sound;1"); - - if (soundInterface) { - soundInterface->Beep(); + mRepeatingMode = eRepeatingNone; + if (!isBackspace) { + // Error beep (don't been when backspace is pressed, they're + // trying to correct the mistake!) + nsCOMPtr soundInterface = + do_CreateInstance("@mozilla.org/sound;1"); + if (soundInterface) { + soundInterface->Beep(); + } } // Remove bad character from buffer, so we can continue typing from // last matched character -#ifdef DONT_ADD_CHAR_IF_NOT_FOUND // If first character is bad, flush it away anyway - if (mTypeAheadBuffer.Length == 1) +#ifdef TYPEAHEADFIND_REMOVE_ALL_BAD_KEYS + // Remove all bad characters + if (mTypeAheadBuffer.Length() >= 1 && !isBackspace) { +#else + // Remove bad *first* characters only + if (mTypeAheadBuffer.Length() == 1 && !isBackspace) { #endif - // Note the if above inside the #ifdef! + // Notice if () in #ifdef above! mTypeAheadBuffer = Substring(mTypeAheadBuffer, 0, mTypeAheadBuffer.Length() - 1); + } } return NS_OK; @@ -968,6 +977,9 @@ nsTypeAheadFind::FindItNow(PRBool aIsRepeatingSameChar, PRBool aIsLinksOnly, findBuffer = PromiseFlatString(mTypeAheadBuffer); } + if (findBuffer.IsEmpty()) + return NS_ERROR_FAILURE; + while (PR_TRUE) { // ----- Outer while loop: go through all docs ----- while (PR_TRUE) { // === Inner while loop: go through a single doc === mFind->Find(findBuffer.get(), mSearchRange, mStartPointRange,