New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 594662 link

Starred by 1 user

Issue metadata

Status: WontFix
Owner: ----
Closed: Mar 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 2
Type: Bug



Sign in to add a comment

DT does not count a whitespace character in the variables-view

Reported by stefan.r...@gmail.com, Mar 14 2016

Issue description

UserAgent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116 Safari/537.36

Steps to reproduce the problem:
1. Create a contenteditable div
2. Place span element with content "asd"
3. Having focus on said span, on the KeyDown event, inspect the actual content of the span according to the HTML code and print out the length of this content. 
4. See that the output prints the content was of length 4 but that the variable view shows just 3 characters "asd" and not "asd " 

What is the expected behavior?
See "other comments" below

What went wrong?
Developer Tool does not show correct values or leaves out whitespace characters.

Did this work before? N/A 

Chrome version: 48.0.2564.116  Channel: n/a
OS Version: 6.1 (Windows 7, Windows Server 2008 R2)
Flash Version: Shockwave Flash 21.0 r0

I am not sure if this isn't a Chrome issue but here we go:

Let tokenWrapper be a InlineLabel containing "asd" as String. Said InlineLabel lives inside a contenteditable panel div.

I am listening to he KeyDown event and capture the spacebar key-down. Since tokenWrapper has the focus at that time, it is correct that it now has 4 characters "*asd *" as content.

Inspecting the HTML code in Chrome shows:

<span class="gwt-InlineLabel" id="tokenwrap-gwt-uid-32">asd​#&8203</span>
Where the Unicode character is highlighted gray; This might indicate that this is a current change.
Inspecting the current values in the developer tool shows me this:

innerTest: "asd"
right: ""
But the actual code:

String innerText = tokenWrapper.getInnerText();

String left = innerText.substring(0, cursorPosition);
String right = innerText.substring(cursorPosition, innerText.length());

GWT.log("start..");

if(left.isEmpty() == true) {    
    GWT.log("Adding whitespace before: " + tokenWrapper.getId());
    parentRow.insertBefore(getWhitespace(), tokenWrapper);
    return;
}

if(right.isEmpty() == true) {       
    GWT.log("Adding whitespace after: " + tokenWrapper.getId());
    Element whitespace = getWhitespace();               
    parentRow.insertAfter(whitespace, tokenWrapper);
    return;
}

GWT.log("innerText: '" + innerText + "' len: " + innerText.length());
GWT.log("right: '" + right + "' len: " + right.length());
Outputs

start..
innertext: 'asd' len: 4
right: '' len: 1
 

Comment 1 by caseq@chromium.org, Mar 14 2016

Cc: paulir...@chromium.org lushnikov@chromium.org caseq@chromium.org
Labels: -OS-Windows Needs-Feedback OS-All
Status: WontFix (was: Unconfirmed)
&#8203 is a zero-width whitespace unicode character, so the fact that you don't see 3 characters instead of 4 is by design. I think we still could still improve handling of the control and characters in strings by offering configurable format options, e.g. escape control character in strings optionally or show hex dump, so copying lushnikov@ to factor this into future console features.
Oh. Stupid me. I guess this issue can be removed then. Thanks for the quick reply! :)

Sign in to add a comment