Skip to content

Commit 592b4d1

Browse files
committed
[hardwrap addon] Fix corner case for words whose length equals the wrap column
Issue codemirror#4069
1 parent 76e252d commit 592b4d1

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

addon/wrap/hardwrap.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@
3030
}
3131

3232
function findBreakPoint(text, column, wrapOn, killTrailingSpace) {
33-
for (var at = column; at > 0; --at)
33+
var at = column
34+
while (at < text.length && text.charAt(at) == " ") at++
35+
for (; at > 0; --at)
3436
if (wrapOn.test(text.slice(at - 1, at + 1))) break;
3537
for (var first = true;; first = false) {
3638
var endOfText = at;

0 commit comments

Comments
 (0)