Skip to content
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

fix replacing end of line with newline #2587

Closed
wants to merge 2 commits into from
Closed

fix replacing end of line with newline #2587

wants to merge 2 commits into from

Conversation

sparecycles
Copy link

Fixes #2586

@msftclas
Copy link

Hi @sparecycles, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution!
You've already signed the contribution license agreement. Thanks!

The agreement was validated by Microsoft and real humans are currently evaluating your PR.

TTYL, MSBOT;

@@ -163,7 +163,7 @@ export abstract class TextAreaState {
if (currentSelectionStart === currentSelectionEnd) {
// composition accept case
// [blahblah] => blahblah|
if (previousValue === currentValue && previousSelectionStart === 0 && previousSelectionEnd === previousValue.length && currentSelectionStart === currentValue.length) {
if (previousValue === currentValue && previousSelectionStart === 0 && previousSelectionEnd === previousValue.length && currentSelectionStart === currentValue.length && currentValue !== '\n') {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alexandrudima

When replacing the end-of-line with a newline, this check results in no typing being recognized (well, on the first typing, on the second it is recorded). I added this specific check for enter but I'm not convinced it's correct.

@alexdima
Copy link
Member

alexdima commented Feb 4, 2016

@sparecycles Thank you! I ended up using a very similar approach inspired from your change in dd751e4 --- to distinguish the composition case in the textareaState by checking if the string contains newline --- and to keep track of the version id emitted via contentChange and emit a dummy event if it fell behind.

Thank you once again! -- now I just need to rewrite that logic -- I hate it :)

@alexdima alexdima closed this Feb 4, 2016
@sparecycles
Copy link
Author

Looks good! Glad to have helped.

@github-actions github-actions bot locked and limited conversation to collaborators Mar 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Replacing selected end-of-line with newline locks up the document
3 participants