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

Issue 643691 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Mar 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 3
Type: Bug



Sign in to add a comment

Ctrl-shift+RightArrow word-by-word selection over-selects

Project Member Reported by gab@chromium.org, Sep 2 2016

Issue description

Ctrl-shift+RightArrow word-by-word selection over-selects and in general "word tokens" tend to include whitespace and non-letter characters after them (e.g. on double-click selection as well). This is a feature all text editors support very well, but Chrome doesn't do a great job at it.

Version: Forever but finally filing bug (currently on 55.0.2846.4)
OS: Tested Windows but probably all.

What steps will reproduce the problem?
(1) Go to http://www.w3schools.com/tags/tryit.asp?filename=tryhtml_textarea
(2) Double-click "make"
that should have selected only "make" but it in practice it selects "make "

(3) Hit ctrl+shift+right-arrow
that should have expanded selection from "make" to "make a" but in practice it expands "make " to "make a " (same issue a (2))

(4) Hit ctrl+shift+right-arrow again
that should expand selection to "make a website" but in practice it expands selection to "make a website. "


What is the expected output?
Ctrl+Arrows navigation works as it does in all text editors and selection (via shift and double-click) also respects word boundaries.

What do you see instead?
It only works backward (ctrl+shift+left-arrow) so my guess is that Chrome only puts "boundary tokens" at the beginning of words which are hit properly when going back but are too far when going forward.

PS: I also noticed that ':' appears to be ignored as a word separator, e.g. double-clicking in "master.tryserver.chromium.linux:linux_chromium_tsan_rel_ng" properly selects individual words except for the last chunk where "linux:linux_chromium_tsan_rel_ng" is considered a single word.


Note: text in linked example text area at time of bug report (in case it changes) : "At w3schools.com you will learn how to make a website. We offer free tutorials in all web development technologies."
 
Labels: -OS-All OS-Windows
Status: WontFix (was: Untriaged)
This is the intended behavior in Windows to be consistent with the native behavior. You won't see it in Linux/Mac.

Double-clicking selects trailing space is set in core/frame/Settings.cpp:

#if OS(WIN)
static const bool defaultSelectTrailingWhitespaceEnabled = true;
#else
static const bool defaultSelectTrailingWhitespaceEnabled = false;
#endif

Ctrl+Shift+Right selects trailing space is set in core/editing/EditingBehavior.h:

// Based on native behavior, when using ctrl(alt)+arrow to move caret by word, ctrl(alt)+left arrow moves caret to
// immediately before the word in all platforms, for example, the word break positions are: "|abc |def |hij |opq".
// But ctrl+right arrow moves caret to "abc |def |hij |opq" on Windows and "abc| def| hij| opq|" on Mac and Linux.
bool shouldSkipSpaceWhenMovingRight() const { return m_type == EditingWindowsBehavior; }

Comment 2 by gab@chromium.org, Sep 12 2016

Owner: xiaoche...@chromium.org
Status: Untriaged (was: WontFix)
Interesting, I just tested WordPad and you're right that it does go over whitespaces. It doesn't however go over punctuation though, i.e. in (3) above it would still have selected "make a website", not "make a website. ".

Either way, this is news to me, all good editors I use on Windows don't do this, should we care to mimic the ancient standard of the platform or instead aim to move the standard to a modern one that makes more sense? Moving standards is what Chrome does :-)

Also, re. PS in OP: ':' appears to be ignored as a word separator, is that expected?

e.g. if I edit this CL's description (https://codereview.chromium.org/2303943003/edit) and ctrl-shift-right from the beginning of "MSDN" it selects all the way to the next line :-O (i.e. neither ':' nor '\n' are delimiters?!)
Cc: yosin@chromium.org
yosin: If I remember correctly, we have a plan to rewrite word boundary finding?

Comment 4 by tkent@chromium.org, Oct 12 2016

Components: -Blink>TextSelection Blink>Editing>Selection

Comment 5 by yosin@chromium.org, Oct 21 2016

Status: Available (was: Untriaged)
Cc: -yosin@chromium.org xiaoche...@chromium.org
Owner: yosin@chromium.org
Status: Assigned (was: Available)
yosin: Does your https://codereview.chromium.org/2754543004 do anything with this issue?

Comment 7 by yosin@chromium.org, Mar 30 2017

Status: Fixed (was: Assigned)
Thanks xiaochengh@, [1] fixed makes Ctrl+ArrowRight not to include trailing punctuation characters.

Including trailing whitespace for Ctrl+ArrowRight (and double-click) is Windows specific behavior.

[1] http://crrev.com/2754543004: Make Selection#modify() with word granularity not to skip punctuation

Sign in to add a comment