question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Pressing keys around hashtag (#) makes cursor jump more than one character

See original GitHub issue

Description From slate 0.70.0, pressing keys around hashtag (#) makes cursor jump more than one character.

Recording jumping

Sandbox https://codesandbox.io/s/slate-0-5x-forked-xdp6z

Steps To reproduce the behavior:

  1. Go to Sandbox from the link above
  2. Type # # foobar
  3. Press arrow key around #
  4. The cursor moves more than one character

Expectation Cursor moves only one character around #

Environment

  • Slate Version: 0.70.0
  • Operating System: CodeSandbox and Ubuntu 20.04
  • Browser: Chrome 95

Context Having tested locally I found that I can observe this behavior from https://github.com/ianstormtaylor/slate/commit/5818aca5038f38465a5769fe944f184be0255341. #4565 Taking look at the code and running additional unit tests (packages/slate/test/utils/string.ts) locally I found that getCharacterDistance handles KeyCap improperly. Below are the test cases I found failing.

const codepoints = [
  ...
  [' #', 1],
  ['# ', 1],
  ...
]

I am not familiar with code point so I might be misunderstanding stuff. Thanks in advance.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
hitochan777commented, Nov 20, 2021

@unageek I see! Anyways thank you for your great work 💯

1reaction
unageekcommented, Nov 19, 2021

@hitochan777 Thank you for your suggestion! I’ve just opened PR #4671 and added the additional tests.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Arrow keys jump more than one character - Super User
They jump to the end of the line instead of just one character. It's so frustraing, been searching around for days now, with...
Read more >
Pressing arrow keys makes the cursor moves two spaces
For some reason, pressing the left or right arrow keys on my keyboard ( Logitech Canvas) makes the cursor moves not one, but...
Read more >
Cursor jumps or moves randomly while typing in Windows 10
If you find that your mouse cursor jumps or moves on its own, automatically, randomly while typing in Windows laptop or computer, then...
Read more >
cursor is jumping when pressing the arrow keys - Stack Overflow
cursor is jumping when pressing the arrow keys ; The way you are stopping them enter # is wrong. You should just check...
Read more >
How to solve the case of the laptop's jumping cursor
Usually when the cursor jumps around without reason, it's caused by the user accidentally hitting the mouse touchpad.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found