Closed
Bug 619910
Opened 15 years ago
Closed 15 years ago
Misplaced autocomplete suggestions when typing a command in a new line
Categories
(DevTools :: General, defect, P2)
DevTools
General
Tracking
(Not tracked)
RESOLVED
FIXED
Firefox 4.0b9
People
(Reporter: AlexLakatos, Assigned: jwalker)
References
Details
(Whiteboard: [4b8])
Attachments
(2 files, 1 obsolete file)
219.81 KB,
image/png
|
Details | |
2.16 KB,
patch
|
Gavin
:
approval2.0+
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (X11; Linux i686; rv:2.0b8) Gecko/20100101 Firefox/4.0b8
Build Identifier: Mozilla/5.0 (X11; Linux i686; rv:2.0b8) Gecko/20100101 Firefox/4.0b8
If you write a multi-line command, the autocomplete does not work properly, it is displayed on the first line instead of being displayed after your command.
Reproducible: Always
Steps to Reproduce:
1.Open Web Console
2.Type a command like console.info("test");
3.Press Shift+Enter from the keyboard to start typing in a new line
4.Write "co" (without quotes) in the console
5.Make sure you get suggestions as you type (autocomplete is working)
Actual Results:
The suggestion is shown on the first line.
Expected Results:
Suggestion should be placed right after your last typed string.
Reporter | ||
Comment 1•15 years ago
|
||
Comment 2•15 years ago
|
||
Confirm this on Mozilla/5.0 (Windows NT 6.1; rv:2.0b8) Gecko/20100101 Firefox/4.0b8
Status: UNCONFIRMED → NEW
Ever confirmed: true
Updated•15 years ago
|
Whiteboard: [4b8]
Reporter | ||
Comment 3•15 years ago
|
||
Bug first appeared in Build 20101209030340.
Updated•15 years ago
|
Updated•15 years ago
|
OS: Windows CE → All
Hardware: x86 → All
Assignee | ||
Comment 4•15 years ago
|
||
The completion field (which is behind the input field) needs a prefix to push the completion string to the correct location.
Plan A was to replace create a string with the same length. This approach caused this bug because it replaced newlines with spaces.
Plan B is to replace all non control characters with spaces instead. The patch uses the regex /[1-\uF000]/g. I'm open to suggestions of a better regex.
The flaw with plan B is that it assumes mono-spaced fonts work for all characters. Some uncommon characters can not be represented in well in a mono-spaced font.
Plan C uses a span[color=transparent] to separate the padding prefix from the displayed completion value, without doing any character replacement.
Plan C is a significantly more complex patch to address a very rare side case.
This patch implements Plan B.
Assignee | ||
Updated•15 years ago
|
Attachment #499000 -
Flags: feedback?(mihai.sucan)
Comment 5•15 years ago
|
||
Comment on attachment 499000 [details] [diff] [review]
Upload 1
The patch looks fine.
Instead of:
+ let prefix = this.inputNode.value.replace(/[!-\uF000]/g, " ");
I'd use:
+ let prefix = this.inputNode.value.replace(/[^\r\n\t ]/g, " ");
But... that's up to the taste of the reviewer as well.
Attachment #499000 -
Flags: feedback?(mihai.sucan) → feedback+
Assignee | ||
Comment 6•15 years ago
|
||
Comment on attachment 499000 [details] [diff] [review]
Upload 1
I'm happy to go with either regex. I went for a blanket exclusion of control chars, Mihai suggested something simpler. I suspect that practically there isn't anything to choose between them, so maybe the simpler option is better.
Attachment #499000 -
Flags: review?(gavin.sharp)
Comment 7•15 years ago
|
||
yeah, I think I like Mihai's suggestion better. I boggled a bit at the \u at first.
Comment 8•15 years ago
|
||
Comment on attachment 499000 [details] [diff] [review]
Upload 1
What about just using \S?
It feels kind of wrong to be doing this string munging work just to get alignment right, though... Can we try to come up with a better way to achieve the desired result?
Attachment #499000 -
Flags: review?(gavin.sharp) → review+
Assignee | ||
Comment 9•15 years ago
|
||
I'll provide you with a patch for Plan C which is the 'correct way', so we can compare.
Assignee | ||
Comment 10•15 years ago
|
||
I'll document plan C better, but having thought about it more, I return to my original opinion that while more 'correct' it's too dangerous at this point in the cycle.
Plan C
------
1. Change the type of the completion node from textbox to a div (or similar), so the completion node can contain styled elements.
2. Rather than setting the completion node to be (input text converted to spaces + completion text) use something like:
<span class=hiddenInput>{inputNode.value}</span><span class=completion>{completion}</span>
3. Use:
.hiddenInput { font-color:transparent; }
.completion { font-color:grey; }
4. Take the used styles of the input node (except font-color), and apply them to the completion node (this step was not previously required since they were both textboxes, and had the same default styles)
The problem is that any omissions or errors in copying styles from the inputNode textbox to the completeNode div cause bugs, and sometimes ones that are hard to test for or that only manifest themselves in peculiar circumstances.
Obviously, I'm happy for there to be a plan D, or for plan C2.
Assignee | ||
Comment 11•15 years ago
|
||
I'm not sure we have any better ideas than this:
let prefix = this.inputNode.value.replace(/[\S]/g, " ");
I've updated the regex to be this and re-tested, and I propose that we commit this in a spare space.
Attachment #499000 -
Attachment is obsolete: true
Comment 12•15 years ago
|
||
Unless Gavin has any additional comments, I think we should go ahead and ask for approval on the new patch.
Assignee | ||
Comment 13•15 years ago
|
||
Gavin has given it r+ and suggested the \S. Should I ask someone for super-review?
Updated•15 years ago
|
Whiteboard: [4b8] → [4b8][checkin]
Updated•15 years ago
|
Attachment #500989 -
Flags: approval2.0?
Comment 15•15 years ago
|
||
got a little ahead of myself. Pending approval this can land.
Whiteboard: [4b8][checkin] → [4b8]
Comment 16•15 years ago
|
||
Comment on attachment 500989 [details] [diff] [review]
[checked-in] Upload 2
Sorry - feel free to just ping me directly if I forget to set approval+ when reviewing something.
Attachment #500989 -
Flags: approval2.0? → approval2.0+
Comment 17•15 years ago
|
||
Comment on attachment 500989 [details] [diff] [review]
[checked-in] Upload 2
http://hg.mozilla.org/mozilla-central/rev/90a8518157c3
Attachment #500989 -
Attachment description: Upload 2 → [checked-in] Upload 2
Updated•15 years ago
|
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 4.0b9
Updated•7 years ago
|
Product: Firefox → DevTools
You need to log in
before you can comment on or make changes to this bug.
Description
•