Closed Bug 135019 Opened 24 years ago Closed 13 years ago

Inline autocomplete: single backspace deletes only the suggestion, should also delete the last character typed

Categories

(Toolkit :: Autocomplete, defect)

defect
Not set
minor

Tracking

()

RESOLVED FIXED
mozilla26

People

(Reporter: jruderman, Assigned: sshagarwal)

References

(Blocks 1 open bug)

Details

(Whiteboard: [good first bug])

Attachments

(1 file, 6 obsolete files)

I have to hit backspace twice to delete a character I just typed in an autocomplete textbox (url bar, mail address widget). This is a regression of bug 59534.
Summary: Backspace after autocomplete does not delete last char typed → Inline autocomplete: backspace does not delete last char typed
Same bug for Thunderbird: bug 239558
<applause> This is one of the major irritants about Mozilla Mail. It's compounded by the fact that autocomplete takes so long to find the (often wrong) address. Suggestion: backspace in the address bar deletes the selected text plus one more character. Would that work? Gerv
Right, pressing backspace should delete the selected (autocompleted) text plus one more character.
Product: Core → Mozilla Application Suite
Assignee: hewitt → nobody
Blocks: 167708
QA Contact: claudius
Severity: normal → minor
OS: Windows 98 → All
Hardware: PC → All
(In reply to comment #3) > Right, pressing backspace should delete the selected (autocompleted) text plus > one more character. Is this the right string to add my backspace problem Jesse? or shall I start a new one? [problem] backspace key doing a function* other than removing entered text [/problem] [*]similates alt+left arrow key function instead[/*]
David, that's a totally separate problem.
ok my bad... sorry
Blocks: 239558
Moving to MailNews Core per Mark Banner's request.
Component: Autocomplete → Composition
Product: SeaMonkey → MailNews Core
QA Contact: composition
I want to work on this bug. Can it be assigned to me?
Sure, done.
Assignee: nobody → rahul123bhardwaj
Status: NEW → ASSIGNED
Attachment #656388 - Flags: review?(markcapella)
Comment on attachment 656388 [details] [diff] [review] Please review the patch and point out the problems I think I was added here by accident - tossing to module owner (correct me if I'm wrong) ...
Attachment #656388 - Flags: review?(markcapella) → review?(mbanner)
Attachment #656388 - Flags: review?(mbanner) → review?(neil)
Comment on attachment 656388 [details] [diff] [review] Please review the patch and point out the problems Well, I have to say that your idea works great in the the case that you want it to work for, so I'll award you f+. However, there are a number of issues: >diff -r 50e4ff05741e toolkit/content/widgets/autocomplete.xml This isn't actually the version used in Thunderbird's compose window. If you meant to change that version, it's xpfe/components/autocomplete/resources/content/autocomplete.xml (in which case some of my remaining comments may not apply). >- this.mEnterEvent = aEvent; >+ this.mEnterEvent = aEvent; Spaces crept on to the end of this line. Please avoid trailing spaces. > #ifdef XP_MACOSX > case KeyEvent.DOM_VK_BACK_SPACE: As you can see, the Mac already has some backspace handling, so your code would not work on the Mac. >- cancel = this.mController.handleDelete(); >+ cancel = this.mController.handleDelete(); Some of the spaces got changed into a tab. Please avoid tabs. >+ case KeyEvent.DOM_VK_BACK_SPACE: The problem here is that you invoke this on any back space event. Firstly, some platforms use Alt or Shift to change the meaning of back space. Secondly, your code only works immediately after an autocomplete. If we're not actually autocompleting, then the code will incorrectly delete some text. >+ var temp_uri = this.textValue; There's no need to make a copy of temp_uri because it's only used once. >+ this.textValue = temp_uri.substring(0,this.selectionStart); Mozilla style is to have a space after the comma. >- Several blank lines seem to have inadvertently disappeared.
Attachment #656388 - Flags: review?(neil) → feedback+
Attached patch patch v2 (obsolete) — — Splinter Review
Attachment #657771 - Flags: review?(mbanner)
Comment on attachment 657771 [details] [diff] [review] patch v2 Neil's the best person to look at this.
Attachment #657771 - Flags: review?(mbanner) → review?(neil)
(In reply to from comment #14) These two comments do not seem to have been addressed: > >+ case KeyEvent.DOM_VK_BACK_SPACE: > The problem here is that you invoke this on any back space event. > Firstly, some platforms use Alt or Shift to change the meaning of back space. > Secondly, your code only works immediately after an autocomplete. If we're > not actually autocompleting, then the code will incorrectly delete some text. > >+ this.textValue = temp_uri.substring(0,this.selectionStart); > Mozilla style is to have a space after the comma.
rb can you update the patch ?
Comment on attachment 657771 [details] [diff] [review] patch v2 Was reviewed by Neil in comment 17, but the review comments have not been addressed by assignee (rahul123bhardwaj) yet.
Attachment #657771 - Flags: review?(neil)
rahul123bhardwaj (aka rb), are you willing to complete your patch to address Neil's review comments of comment 16 (shortly after you filed your last wip patch)?
Flags: needinfo?(rahul123bhardwaj)
Summary: Inline autocomplete: backspace does not delete last char typed → Inline autocomplete: single backspace deletes only the suggestion, should also delete the last character typed
I am sorry, I would not be able to work on this patch. we can assign this bug to someone who is willing to look at it.
Flags: needinfo?(rahul123bhardwaj)
Assignee: rahul123bhardwaj → nobody
Status: ASSIGNED → NEW
This has a wip patch with review from Neil in comment 17, should be simple, probably just 10 lines of code or so.
Whiteboard: [good first bug][has wip patch][review comment 17]
Attached patch Possible fix (obsolete) — — Splinter Review
I have tried to take care of the alt, ctrl and autocomplete (though not sure if this is the right way to check for autocompletion).
Attachment #656388 - Attachment is obsolete: true
Attachment #788232 - Flags: review?(neil)
(In reply to Suyash Agarwal from comment #23) > I have tried to take care of the alt, ctrl I actually said alt and shift but you're right to mention ctrl (and you misspelled alt in your patch). > and autocomplete (though not sure if this is the right way to check for autocompletion). No, this just checks whether autocomplete is enabled. Ideally you would detect whether the text in the widget had just been suggested and therefore that pressing backspace would normally delete the suggestion and you therefore want to delete it yourself so that backspace will also delete the last character typed. However I'm not sure that we currently provide an easy way to determine this, or at least, not all of this. [On an unrelated note, autoFillInput, which is the method that actually adds the suggestion, manages to refer to the same value using no fewer than three different variable names. Sigh.]
(In reply to neil@parkwaycc.co.uk from comment #24) > I actually said alt and shift but you're right to mention ctrl (and you > misspelled alt in your patch). Sorry, I will add shift too. > No, this just checks whether autocomplete is enabled. Ideally you would > detect whether the text in the widget had just been suggested and therefore > that pressing backspace would normally delete the suggestion and you > therefore want to delete it yourself so that backspace will also delete the > last character typed. then this should work, we are just making the length of suggestion to zero here, so if it(suggestion) isn't there then, that should not affect anything and so, the backspace will just be deleting a single character either way. Please correct me if I am making incorrect assumptions.
Attachment #788232 - Flags: feedback?(acelists)
Comment on attachment 788232 [details] [diff] [review] Possible fix Review of attachment 788232 [details] [diff] [review]: ----------------------------------------------------------------- Yes, this seems to work in msg compose.
Attachment #788232 - Flags: feedback?(acelists) → feedback+
Attached patch Possible fix v2 (obsolete) — — Splinter Review
I have tried using this.mDefaultMatchFilled As this is made true in autoFillInput() when the input is suggested.
Attachment #788232 - Attachment is obsolete: true
Attachment #788232 - Flags: review?(neil)
Attachment #790720 - Flags: review?(neil)
Comment on attachment 790720 [details] [diff] [review] Possible fix v2 Just some style nits: > break; >+ case KeyEvent.DOM_VK_BACK_SPACE: Please leave a blank line before the case. >+ if (this.mDefaultMatchFilled && !aEvent.ctrlKey && >+ !aEvent.altKey && !aEvent.shiftKey) { I don't like the way this wraps, perhaps use: if (!aEvent.ctrlKey && !aEvent.altKey && !aEvent.shiftKey && this.mDefaultMatchFilled) { >+ this.value = this.value.substring(0, this.selectionStart); [Could use this.currentSearchString perhaps?] [Should we clear this.mDefaultMatchFilled]?
Attachment #790720 - Flags: review?(neil) → review+
Using currentSearchString doesn't seem to work, I don't know why I also tried setting this.currentSearchString = aValue; in method setTextValue() but no effect.
So, should I carry over the review without making the currentSearchString change?
Flags: needinfo?(neil)
Attached patch Possible fix with nits (obsolete) — — Splinter Review
Attachment #790720 - Attachment is obsolete: true
Attached patch Possible fix with nits (obsolete) — — Splinter Review
Please ignore the previous patch.
Assignee: nobody → syshagarwal
Attachment #790747 - Attachment is obsolete: true
Status: NEW → ASSIGNED
Whiteboard: [good first bug][has wip patch][review comment 17] → [good first bug]
(In reply to Suyash Agarwal from comment #29) > Using currentSearchString doesn't seem to work, I don't know why > I also tried setting this.currentSearchString = aValue; in method > setTextValue() but no effect. Maybe I was unclear, I meant instead of this.value.substring(0, this.selectionStart)
Flags: needinfo?(neil)
Ya, this works! :) Carrying over review from Neil.
Attachment #657771 - Attachment is obsolete: true
Attachment #790751 - Attachment is obsolete: true
Attachment #790756 - Flags: review+
Keywords: checkin-needed
Neil, should this bug be moved to some better component in Core/XPFE so that it is checked in to the proper tree?
Component: Composition → Autocomplete
Product: MailNews Core → Toolkit
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla26
Pushed by frgrahl@gmx.net: https://hg.mozilla.org/comm-central/rev/78bb1e757a33 Inline autocomplete: single backspace deletes the last character typed along with the suggestion. r=Neil
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: