开发者

Ctrl + Arrows: What algorithm or standard?

开发者 https://www.devze.com 2022-12-09 10:30 出处:网络
Is there some agreed upon algorithm of what is supposed to happen when, in a text editor or te开发者_开发百科xt editing field, the user presses Ctrl + Left-Arrow or Ctrl + Right-Arrow? I noticed the b

Is there some agreed upon algorithm of what is supposed to happen when, in a text editor or te开发者_开发百科xt editing field, the user presses Ctrl + Left-Arrow or Ctrl + Right-Arrow? I noticed the behavior in Chrome's text box, and Windows Notepad, for instance, aren't the same; the "jump to the last/ next bit" pattern is similar but not the same.

I'm looking for this info to emulate the behavior in my own Chrome/JavaScript-based text editor, as I'm not happy with how Chrome handles this at times.


Standard action would be, jump to the next non-whitespace block of text in either direction (and as you noted this can depend on context of 'non-whitespace block')


This is more than a browser-specific inconsistency, it's different across OSes. On Mac OS, Ctrl + Left/Right/Up/Down switches to a different Space (desktop), so you might not want to use this as an important keybinding if you want to serve Mac users as well.

This is more about the keybinding than the algorithm, I just wanted to throw that out there. :)


You should be platform-specific if necessary. Linux & windows jump to the next word, and they select if also shifted.

0

精彩评论

暂无评论...
验证码 换一张
取 消