mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Merge pull request #16075 from atom/fix-select-word
Fix select-word command between word and non-word chararacters
This commit is contained in:
@@ -2007,13 +2007,17 @@ describe('TextEditor', () => {
|
||||
|
||||
describe('when the cursor is between two words', () => {
|
||||
it('selects the word the cursor is on', () => {
|
||||
editor.setCursorScreenPosition([0, 4])
|
||||
editor.setCursorBufferPosition([0, 4])
|
||||
editor.selectWordsContainingCursors()
|
||||
expect(editor.getSelectedText()).toBe('quicksort')
|
||||
|
||||
editor.setCursorScreenPosition([0, 3])
|
||||
editor.setCursorBufferPosition([0, 3])
|
||||
editor.selectWordsContainingCursors()
|
||||
expect(editor.getSelectedText()).toBe('var')
|
||||
|
||||
editor.setCursorBufferPosition([1, 22])
|
||||
editor.selectWordsContainingCursors()
|
||||
expect(editor.getSelectedText()).toBe('items')
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -594,7 +594,7 @@ class Cursor extends Model {
|
||||
getCurrentWordBufferRange (options = {}) {
|
||||
const position = this.getBufferPosition()
|
||||
const ranges = this.editor.buffer.findAllInRangeSync(
|
||||
options.wordRegex || this.wordRegExp(),
|
||||
options.wordRegex || this.wordRegExp(options),
|
||||
new Range(new Point(position.row, 0), new Point(position.row, Infinity))
|
||||
)
|
||||
const range = ranges.find(range =>
|
||||
|
||||
Reference in New Issue
Block a user