From 2063f369f40e898b34e4796f598427e4a7fc5193 Mon Sep 17 00:00:00 2001 From: "gavin%gavinsharp.com" Date: Wed, 28 Dec 2005 00:41:47 +0000 Subject: [PATCH] Bug 202992: h or htt cut off in address bar autocomplete (adds :// to domain names starting with p or t), patch by Tom S. , r=mconnor --- .../autocomplete/src/nsAutoCompleteController.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/toolkit/components/autocomplete/src/nsAutoCompleteController.cpp b/toolkit/components/autocomplete/src/nsAutoCompleteController.cpp index aab70493e019..23e797514186 100644 --- a/toolkit/components/autocomplete/src/nsAutoCompleteController.cpp +++ b/toolkit/components/autocomplete/src/nsAutoCompleteController.cpp @@ -1166,13 +1166,23 @@ nsAutoCompleteController::CompleteDefaultIndex(PRInt32 aSearchIndex) nsresult nsAutoCompleteController::CompleteValue(nsString &aValue, PRBool selectDifference) { - nsString::const_iterator start, end, iter; + nsString::const_iterator start, end, iter, skip; PRInt32 startSelect, endSelect; + mSearchString.BeginReading(start); + mSearchString.EndReading(end); + PRBool searchScheme = FindInReadable(NS_LITERAL_STRING("://"), start, end); + aValue.BeginReading(start); aValue.EndReading(end); iter = start; + // Skip "://"-suffixed scheme unless explicitly searched for (bug 202992). + if (!searchScheme) { + skip = end; + iter = FindInReadable(NS_LITERAL_STRING("://"), iter, skip) ? skip : start; + } + FindInReadable(mSearchString, iter, end, nsCaseInsensitiveStringComparator());