mirror of
https://github.com/atom/atom.git
synced 2026-02-15 00:55:14 -05:00
Merge remote-tracking branch 'origin/dev' into cefode
This commit is contained in:
@@ -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())
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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", ->
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user