From 1d2fa089e5cc8e4b054cf1a41cc0f8b90e8af14b Mon Sep 17 00:00:00 2001 From: Corey Johnson & Kevin Sawicki Date: Mon, 28 Jan 2013 12:00:12 -0800 Subject: [PATCH] editor.wordRegex is now a config option. --- src/app/cursor.coffee | 5 ++--- src/app/editor.coffee | 1 + 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/cursor.coffee b/src/app/cursor.coffee index 4599705f3..efc80fbf4 100644 --- a/src/app/cursor.coffee +++ b/src/app/cursor.coffee @@ -9,7 +9,6 @@ class Cursor screenPosition: null bufferPosition: null goalColumn: null - wordRegex: /(\w+)|([^\w\n]+)/g visible: true needsAutoscroll: false @@ -150,7 +149,7 @@ class Cursor previousLinesRange = [[previousNonBlankRow, 0], currentBufferPosition] beginningOfWordPosition = currentBufferPosition - @editSession.backwardsScanInRange (options.wordRegex || @wordRegex), previousLinesRange, (match, matchRange, { stop }) => + @editSession.backwardsScanInRange (options.wordRegex ? config.get("editor.wordRegex")), previousLinesRange, (match, matchRange, { stop }) => if matchRange.end.isGreaterThanOrEqual(currentBufferPosition) or allowPrevious beginningOfWordPosition = matchRange.start stop() @@ -162,7 +161,7 @@ class Cursor range = [currentBufferPosition, @editSession.getEofBufferPosition()] endOfWordPosition = null - @editSession.scanInRange (options.wordRegex || @wordRegex), range, (match, matchRange, { stop }) => + @editSession.scanInRange (options.wordRegex ? config.get("editor.wordRegex")), range, (match, matchRange, { stop }) => endOfWordPosition = matchRange.end if not allowNext and matchRange.start.isGreaterThan(currentBufferPosition) endOfWordPosition = currentBufferPosition diff --git a/src/app/editor.coffee b/src/app/editor.coffee index 0fb628d4d..55600c0fa 100644 --- a/src/app/editor.coffee +++ b/src/app/editor.coffee @@ -19,6 +19,7 @@ class Editor extends View autosave: false autoIndent: true autoIndentOnPaste: false + wordRegex: /(\w+)|([^\w\n]+)/g @content: (params) -> @div class: @classes(params), tabindex: -1, =>