New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Highlight pasted input #24
Highlight pasted input #24
Conversation
Hm, that's a bit unusual. What's it for? |
src/index.js
Outdated
@@ -49,7 +50,7 @@ class TextInput extends PureComponent { | |||
|
|||
let i = 0; | |||
for (const char of value) { | |||
if (i++ === cursorOffset) { | |||
if (i >= cursorOffset - cursorWidth & i++ <= cursorOffset) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a comment with an explanation what and how is being calculated here? What's &
for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry this is a mistake
Hm, never noticed it myself, you're right! Let's indeed expose it via a prop, disabled by default, since it would be a breaking change otherwise. We can reconsider the default value for the next major release ;) |
Done, now there is a prop |
Could you rename it to |
Done!! |
Thank you, great addition! |
With this PR, when you paste something, the input pasted is highlighted.
This only works whit pasted input that has more than one char.