-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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 textarea newline handle #32966
base: main
Are you sure you want to change the base?
fix textarea newline handle #32966
Conversation
metiftikci
commented
Dec 23, 2024
- Fix cursor position if input newline on middle of lines
- Increment number if numbered list
} else { | ||
// start a new line with the same indention and prefix | ||
let newPrefix = prefix; | ||
// a simple approach, otherwise it needs to parse the lines after the current line | ||
if (/^\d+\./.test(prefix)) newPrefix = `1. ${newPrefix.slice(newPrefix.indexOf('.') + 2)}`; |
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.
not sure what old code does
got it
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.
Comment above // a simple approach, otherwise it needs to parse the lines after the current line
I guess it's not right for this case:
Your result might be
? I didn't do that (auto-increase) because it needs a complex algorithm to make it right. And for most cases only using I added a new test: |
@wxiaoguang should i revert the increase number code or try to implement increasing numbers below? |
Either is fine, but there are many edge cases, even GitHub doesn't get it completely right, and it would be quite complex, maybe at least hundreds lines of code in my mind. So at the moment, I would prefer to revert "the increase number" |