mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
Merge pull request #18287 from atom/dw-fix-18195
Don't soft-wrap spaces and '/' to new lines
This commit is contained in:
@@ -561,7 +561,7 @@ describe('TextEditor', () => {
|
||||
it('wraps to the end of the previous line', () => {
|
||||
editor.setCursorScreenPosition([4, 4])
|
||||
editor.moveLeft()
|
||||
expect(editor.getCursorScreenPosition()).toEqual([3, 49])
|
||||
expect(editor.getCursorScreenPosition()).toEqual([3, 46])
|
||||
})
|
||||
})
|
||||
|
||||
@@ -791,7 +791,7 @@ describe('TextEditor', () => {
|
||||
editor.setCursorScreenPosition([0, 2])
|
||||
editor.moveToEndOfLine()
|
||||
const cursor = editor.getLastCursor()
|
||||
expect(cursor.getScreenPosition()).toEqual([3, 5])
|
||||
expect(cursor.getScreenPosition()).toEqual([4, 4])
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -99,12 +99,19 @@ const isCJKCharacter = (character) =>
|
||||
isKoreanCharacter(character)
|
||||
|
||||
const isWordStart = (previousCharacter, character) =>
|
||||
((previousCharacter === ' ') || (previousCharacter === '\t')) &&
|
||||
((character !== ' ') && (character !== '\t'))
|
||||
(
|
||||
previousCharacter === ' ' ||
|
||||
previousCharacter === '\t' ||
|
||||
previousCharacter === '-' ||
|
||||
previousCharacter === '/'
|
||||
) &&
|
||||
(
|
||||
character !== ' ' &&
|
||||
character !== '\t'
|
||||
)
|
||||
|
||||
const isWrapBoundary = (previousCharacter, character) =>
|
||||
isWordStart(previousCharacter, character) || isCJKCharacter(character) ||
|
||||
previousCharacter === '-' || character === '/' || character === ' '
|
||||
isWordStart(previousCharacter, character) || isCJKCharacter(character)
|
||||
|
||||
// Does the given string contain at least surrogate pair, variation sequence,
|
||||
// or combined character?
|
||||
|
||||
Reference in New Issue
Block a user