Make soft-wrap break words before a slash or space and after a dash

This commit is contained in:
ariasuni
2018-08-30 01:29:31 +02:00
committed by Mélanie Chauvel (ariasuni)
parent 5e64cdcf17
commit 81364b6a1c
2 changed files with 4 additions and 3 deletions

View File

@@ -560,7 +560,7 @@ describe('TextEditor', () => {
it('wraps to the end of the previous line', () => {
editor.setCursorScreenPosition([4, 4])
editor.moveLeft()
expect(editor.getCursorScreenPosition()).toEqual([3, 46])
expect(editor.getCursorScreenPosition()).toEqual([3, 49])
})
})
@@ -790,7 +790,7 @@ describe('TextEditor', () => {
editor.setCursorScreenPosition([0, 2])
editor.moveToEndOfLine()
const cursor = editor.getLastCursor()
expect(cursor.getScreenPosition()).toEqual([4, 4])
expect(cursor.getScreenPosition()).toEqual([3, 5])
})
})

View File

@@ -103,7 +103,8 @@ const isWordStart = (previousCharacter, character) =>
((character !== ' ') && (character !== '\t'))
const isWrapBoundary = (previousCharacter, character) =>
isWordStart(previousCharacter, character) || isCJKCharacter(character)
isWordStart(previousCharacter, character) || isCJKCharacter(character) ||
previousCharacter === '-' || character === '/' || character === ' '
// Does the given string contain at least surrogate pair, variation sequence,
// or combined character?