We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7db2d71 commit 5ac6459Copy full SHA for 5ac6459
cli/src/components/multiline-input.tsx
@@ -652,7 +652,11 @@ export const MultilineInput = forwardRef<
652
if (afterNewline === -1) {
653
afterNewline = value.length
654
}
655
- let prevNewlineExclusive = value.lastIndexOf('\n', cursorPosition - 1)
+ // For some reason, there is a special case for lastIndexOf for negative indices if the match is a prefix
656
+ let prevNewlineExclusive =
657
+ cursorPosition === 0
658
+ ? -1
659
+ : value.lastIndexOf('\n', cursorPosition - 1)
660
const col = (cursorPosition - prevNewlineExclusive) % cols
661
onChange({
662
text: value,
0 commit comments