Merge remote-tracking branch 'origin/dev' into cefode

This commit is contained in:
Kevin Sawicki & Nathan Sobo
2013-03-05 14:54:07 -08:00
12 changed files with 62 additions and 12 deletions

View File

@@ -12,6 +12,8 @@ class ScreenLine
new ScreenLine({@tokens, @ruleStack, @bufferRows, @startBufferColumn, @fold})
clipScreenColumn: (column, options={}) ->
return 0 if @tokens.length == 0
{ skipAtomicTokens } = options
column = Math.min(column, @getMaxScreenColumn())

View File

@@ -164,7 +164,7 @@ class Selection
if options.autoIndent
if text == '\n'
@editSession.autoIndentBufferRow(newBufferRange.end.row)
else
else if /\S/.test(text)
@editSession.autoDecreaseIndentForRow(newBufferRange.start.row)
newBufferRange

View File

@@ -39,6 +39,11 @@ class MisspellingView extends View
getScreenRange: ->
new Range(@startPosition, @endPosition)
unsubscribe: ->
super
@editSession.destroyMarker(@marker)
containsCursor: ->
cursor = @editor.getCursorScreenPosition()
@getScreenRange().containsPoint(cursor, exclusive: false)

View File

@@ -96,3 +96,19 @@ describe "Spell check", ->
expect(editor.find('.corrections').length).toBe 1
expect(editor.find('.corrections li').length).toBe 0
expect(editor.find('.corrections .error').text()).toBe "No corrections found"
describe "when the edit session is destroyed", ->
it "destroys all misspelling markers", ->
editor.setText("mispelling")
config.set('spell-check.grammars', ['source.js'])
waitsFor ->
editor.find('.misspelling').length > 0
runs ->
expect(editor.find('.misspelling').length).toBe 1
view = editor.find('.misspelling').view()
buffer = editor.getBuffer()
expect(buffer.getMarkerPosition(view.marker)).not.toBeUndefined()
editor.destroyEditSessions()
expect(buffer.getMarkerPosition(view.marker)).toBeUndefined()

View File

@@ -11,6 +11,7 @@ describe "WrapGuide", ->
editor = rootView.getActiveEditor()
wrapGuide = rootView.find('.wrap-guide').view()
editor.width(editor.charWidth * wrapGuide.getDefaultColumn() * 2)
editor.trigger 'resize'
describe "@initialize", ->
it "appends a wrap guide to all existing and new editors", ->

View File

@@ -21,7 +21,8 @@ module.exports =
cson = '[\n'
for value in array
cson += @stringifyIndent(indentLevel + 2)
indent = @stringifyIndent(indentLevel + 2)
cson += indent
if _.isString(value)
cson += @stringifyString(value)
else if _.isBoolean(value)
@@ -33,13 +34,15 @@ module.exports =
else if _.isArray(value)
cson += @stringifyArray(value, indentLevel + 2)
else if _.isObject(value)
cson += @stringifyObject(value, indentLevel + 2)
cson += "{\n#{@stringifyObject(value, indentLevel + 4)}\n#{indent}}"
else
throw new Error("Unrecognized type for array value: #{value}")
cson += '\n'
"#{cson}#{@stringifyIndent(indentLevel)}]"
stringifyObject: (object, indentLevel=0) ->
return '{}' if _.isEmpty(object)
cson = ''
prefix = ''
for key, value of object