Closed Bug 233205 Opened 21 years ago Closed 20 years ago

Pressing Ctrl+Enter does not remove trailing spaces

Categories

(Firefox :: Address Bar, defect, P4)

x86
All
defect

Tracking

()

VERIFIED FIXED
Firefox1.0beta

People

(Reporter: dipesh, Assigned: patrick)

References

Details

(Whiteboard: fixed0.9)

Attachments

(1 file)

User-Agent:       
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5) Gecko/20031007 Firebird/0.7

When reading any email, a company's name or product name is encountered and we
would like to know the details about the company. Most of the time there would
be a website with .com name.

If we double-click on the name and copy the word than a trailing space is also
copied. Than we open a new tab and paste the text and hit Ctrl+Enter which would
fillup the URL with http://wwww. and trailing .com. But it does not truncate the
word.

So if we have copied mozilla word and pasted in address bar and hit enter than
it would be formed as http://www.mozilla .com and say URL is not valid.

Also when a link is copied and we paste in address bar, than we have to position
the cursor and hit enter. It would be nice if it has GO button like IE so that
we can paste the URL and click on GO button.

Reproducible: Always
Steps to Reproduce:
1. double-click any word in any website and start new tab and paste and hit
ctrl+enter
2. enter url as mozilla with a space after and hit ctrl+enter


Actual Results:  
URL is invalid

Expected Results:  
it should trucate the address bar and show the web page
david, if this isn't a dupe, assign it to me and I'll patch this.
It's definitely not a dupe of anything. 
 
I do wonder why we don't invoke Google's "I'm feeling lucky" search though 
since that would tend, most of the time, to yield the desired page... just a 
thought. 
Assignee: hewitt → mconnor
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Windows XP → All
This is more browser.js:canonizeUrl() bustage.  Also see bug 233205 and bug 
218447.

To answer David's question, IK (Internet Keywords, aka "I'm Feeling Lucky") is 
not being invoked because canonizeUrl() goes first.  I am starting to think we 
should get rid of canonizeUrl since IK will do the same thing.

If we add the following to each of the if clauses in canonizeUrl(), the bug 
goes away:

      // trim leading/trailing spaces
      url = url.replace( /^\s+/, "");
      url = url.replace( /\s+$/, "");

If there is interest in this, I can write a post-218447 patch that does this.  
(I would restructure the if statement so that the regex's are not copied three 
times.)

If there is a better way to trim leading/trailing spaces in JS than a regex, 
let me know; I don't know much about JS builtins.
Status: NEW → ASSIGNED
Priority: -- → P4
Target Milestone: --- → Firefox1.0beta
also removes one busted comment. (referred to .org instead of .net)
tested with tip FF build.
Assignee: mconnor → patrick
Attachment #149536 - Flags: review?(mconnor)
Comment on attachment 149536 [details] [diff] [review]
browser.js patch that strips leading/trailing whitespace from url

r=mconnor@myrealbox.com
Attachment #149536 - Flags: review?(mconnor) → review+
Whiteboard: checkin0.9
checked in branch and trunk
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Whiteboard: checkin0.9 → fixed0.9
I don't want to be a jerk or insist on this just because it's my creation, but
the patch I sent to bug 233853 18 days ago would fix a couple bugs related to
ctrl+enter, including this one, yet it never got a review. Could someone please
take a look at it?
Bug 260761 seems to be related to this one because it's a similar behavior when
dragging a text link onto the url bar.

Btw. I can verify that this bug is fixed.
Blocks: 260761
Status: RESOLVED → VERIFIED
*** Bug 228747 has been marked as a duplicate of this bug. ***
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: