Skip to content

Commit

Permalink
Apply patch from E/App (#406)
Browse files Browse the repository at this point in the history
  • Loading branch information
roryabraham authored Jun 28, 2024
1 parent fa902fa commit a83eff4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/web/cursorUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function setCursorPosition(target: HTMLElement, start: number, end: number | nul
// 3. Caret at the end of whole input, when pressing enter
// 4. All other placements
if (prevChar === '\n' && prevTextLength !== undefined && prevTextLength < textCharacters.length) {
if (nextChar !== '\n') {
if (nextChar && nextChar !== '\n' && i !== n - 1) {
range.setStart(textNodes[i + 1] as Node, 0);
} else if (i !== textNodes.length - 1) {
range.setStart(textNodes[i] as Node, 1);
Expand Down

0 comments on commit a83eff4

Please sign in to comment.