Also consider ' and " word separators

For example URIs in json
This commit is contained in:
Daniel Imms
2017-06-18 11:51:00 -07:00
parent a59b2f8433
commit 07882c42dc
2 changed files with 10 additions and 2 deletions
+9 -1
View File
@@ -143,7 +143,7 @@ describe('SelectionManager', () => {
assert.equal(selectionManager.selectionText, 'foo');
});
it('should select up to non-path characters that are commonly adjacent to paths', () => {
buffer.push(stringToRow(':ab:(cd)[ef]{gh}'));
buffer.push(stringToRow(':ab:(cd)[ef]{gh}\'ij"'));
selectionManager.selectWordAt([0, 0]);
assert.equal(selectionManager.selectionText, ':ab');
selectionManager.selectWordAt([1, 0]);
@@ -176,6 +176,14 @@ describe('SelectionManager', () => {
assert.equal(selectionManager.selectionText, 'gh');
selectionManager.selectWordAt([15, 0]);
assert.equal(selectionManager.selectionText, 'gh}');
selectionManager.selectWordAt([16, 0]);
assert.equal(selectionManager.selectionText, '\'ij');
selectionManager.selectWordAt([17, 0]);
assert.equal(selectionManager.selectionText, 'ij');
selectionManager.selectWordAt([18, 0]);
assert.equal(selectionManager.selectionText, 'ij');
selectionManager.selectWordAt([19, 0]);
assert.equal(selectionManager.selectionText, 'ij"');
});
});
+1 -1
View File
@@ -41,7 +41,7 @@ const CLEAR_MOUSE_DISTANCE = 10;
* A string containing all characters that are considered word separated by the
* double click to select work logic.
*/
const WORD_SEPARATORS = ' ()[]{}:';
const WORD_SEPARATORS = ' ()[]{}:\'"';
// TODO: Move these constants elsewhere, they belong in a buffer or buffer
// data/line class.