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."
Comment 1 by xiaoche...@chromium.org
, Sep 12 2016Status: 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; }