Closed
Bug 260908
Opened 21 years ago
Closed 16 years ago
Trim leading & trailing whitespace on new form history entries
Categories
(Toolkit :: Form Manager, enhancement)
Toolkit
Form Manager
Tracking
()
RESOLVED
FIXED
mozilla1.9.2a1
People
(Reporter: bugzilla, Assigned: MattN)
Details
Attachments
(2 files, 1 obsolete file)
|
15.44 KB,
image/gif
|
Details | |
|
6.07 KB,
patch
|
Dolske
:
review+
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; rv:1.7.3) Gecko/20040913 Firefox/0.10
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; rv:1.7.3) Gecko/20040913 Firefox/0.10
AutoComplete should not save trailing spaces on saved data. I just performed a
search on Amazon.com, and found I had three copies of the same one word search
option available in autocomplete...one with no trailing spaces, one with a
single trailing space, one with two trailing spaces. Logically there is no
reason for this, and there should be only one AutoComplete option with trailing
(and potentially leading) spaces trimmed.
Reproducible: Always
Steps to Reproduce:
| Reporter | ||
Comment 1•21 years ago
|
||
| Reporter | ||
Comment 2•20 years ago
|
||
This also affects the search toolbar (Google, wiki, etc...).
Can't anybody confirm this for me?
Using 1.0.3 now.
Comment 3•20 years ago
|
||
Yes I've just experienced this as well, and it was irritating enough to file a bug.
I don't think whitespace before should be trimmed, however, as this would affect
the visual appearance of the text. However, with the trailing space, you get
multiple entries that are exactly the same.
Severity should be trival or enhancement.
Comment 4•20 years ago
|
||
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b4) Gecko/20050901
Firefox/1.0+ ID:2005090106
This behavior does indeed exists. I'm not certain it should be in core instead
of an extension, but I agree the functionality would be handy (a configurable
option, perhaps?).
Confirming and reclassifying as enhancement.
Severity: normal → enhancement
Status: UNCONFIRMED → NEW
Ever confirmed: true
Updated•18 years ago
|
Assignee: bugs → nobody
Updated•17 years ago
|
Product: Firefox → Toolkit
| Assignee | ||
Comment 6•16 years ago
|
||
Attachment #378445 -
Flags: review?(dolske)
Comment 7•16 years ago
|
||
Comment on attachment 378445 [details] [diff] [review]
Patch v.1 (with mochitests)
>--- a/toolkit/components/satchel/src/nsStorageFormHistory.cpp
...
>+ value.Trim(" ", PR_FALSE, PR_TRUE);
I think this should be:
value.Trim(" \t", PR_TRUE, PR_TRUE);
Strips tabs too (afaict \r\n can't really make it in), and we should trim leading space as well as trailing.
I wonder if it's worth clobbering duplicate whitespace within the string? (eg, double spaces). There is a .CompressWhiteSpace()... I'd be a little wary of some use-case wanting to preserve such spacing, but can't think of any. In my big 27,000 form history DB, I had 290 entries with at least 2 concurrent spaces, and 7 with 3 concurrent spaces (none with more). All looked like typos or cut'n'paste duplication. Will your intrastring matching in bug 370117 care either way? Maybe this just isn't worth doing.
The thought also occurs to me that we could do a 1-time pass to strip any existing entries, but I don't think that's work the effort and risk. (Now that we expire old unused entries, they'll eventually drop from the DB naturally).
>--- a/toolkit/components/satchel/test/test_form_submission.html
>+ case 104:
>+ ok(fh.entryExists("test4", " trimTrailingSpaceOnly"), "checking saved value is trimmed on the right only");
>+ ok(!fh.entryExists("test4", "trimTrailingSpaceOnly"), "checking that value is not trimmed on both sides");
>+ ok(!fh.entryExists("test4", " trimTrailingSpaceOnly "), "checking that untrimmed value is not saved");
>+ break;
Seems unlikely that we'd manage to save multiple versions of a single input. No need for the negative checks.
Attachment #378445 -
Flags: review?(dolske) → review-
| Assignee | ||
Comment 8•16 years ago
|
||
> I wonder if it's worth clobbering duplicate whitespace within the string? (eg,
double spaces). There is a .CompressWhiteSpace()... I'd be a little wary of
some use-case wanting to preserve such spacing, but can't think of any. In my
big 27,000 form history DB, I had 290 entries with at least 2 concurrent
spaces, and 7 with 3 concurrent spaces (none with more). All looked like typos
or cut'n'paste duplication. Will your intrastring matching in bug 370117 care
either way? Maybe this just isn't worth doing.
I don't think that compressing whitespace within the fields is a good idea. An example use case is people who put type two spaces following a period in a sentence. The current patch on that bug does substring matching, not word matching, and so whitespace between words would have to be the same to match. We can use experiment with the fulltext extension to match words.
> The thought also occurs to me that we could do a 1-time pass to strip any
existing entries, but I don't think that's work the effort and risk. (Now that
we expire old unused entries, they'll eventually drop from the DB naturally).
I agree that this could be useful especially if someone uses an item in form history that had leading/trailing spaces and then submits it on form creating a new form history entry for the trimmed version, thus, creating duplicates which is the problem that this bug is trying to solve.
Attachment #378445 -
Attachment is obsolete: true
Attachment #378811 -
Flags: review?(dolske)
| Assignee | ||
Updated•16 years ago
|
Assignee: nobody → mnoorenberghe
Status: NEW → ASSIGNED
Summary: Trailing spaces should be trimmed from AutoComplete → Trim leading & trailing whitespace on new form history entries
Updated•16 years ago
|
Attachment #378811 -
Flags: review?(dolske) → review+
Comment 9•16 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9.2a1
Updated•16 years ago
|
Flags: in-testsuite+
You need to log in
before you can comment on or make changes to this bug.
Description
•