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

Binary file not shown.

View File

@@ -370,6 +370,7 @@ namespace v8_extensions {
};
Git::Git() : CefV8Handler() {
git_threads_init();
}
void Git::CreateContextBinding(CefRefPtr<CefV8Context> context) {

View File

@@ -3,7 +3,8 @@
# From root of libgit2 repo:
# mkdir build
# cd build
# cmake .. -DCMAKE_INSTALL_PREFIX=~/repos/atom/git2 -DCMAKE_OSX_ARCHITECTURES="i386;x86_64" -DCMAKE_BUILD_TYPE=Release
# cmake .. -DCMAKE_INSTALL_PREFIX=~/github/atom/git2 -DCMAKE_OSX_ARCHITECTURES="i386;x86_64" -DCMAKE_BUILD_TYPE=Release -DTHREADSAFE=1 -DBUILD_CLAR=OFF
# cmake --build . --target install
#
# From root of atom repo:

View File

@@ -1,5 +1,6 @@
DisplayBuffer = require 'display-buffer'
Buffer = require 'buffer'
_ = require 'underscore'
describe "DisplayBuffer", ->
[editSession, displayBuffer, buffer, changeHandler, tabLength] = []
@@ -55,6 +56,13 @@ describe "DisplayBuffer", ->
describe "when the buffer changes", ->
describe "when buffer lines are updated", ->
describe "when whitespace is added after the max line length", ->
it "adds whitespace to the end of the current line and wraps an empty line", ->
fiftyCharacters = _.multiplyString("x", 50)
editSession.buffer.setText(fiftyCharacters)
editSession.setCursorBufferPosition([0, 51])
editSession.insertText(" ")
describe "when the update makes a soft-wrapped line shorter than the max line length", ->
it "rewraps the line and emits a change event", ->
buffer.delete([[6, 24], [6, 42]])

View File

@@ -793,12 +793,21 @@ describe "EditSession", ->
expect(editSession.indentationForBufferRow(2)).toBe editSession.indentationForBufferRow(1)
describe "when the preceding does not match an auto-indent pattern", ->
it "auto-decreases the indentation of the line to be one level below that of the preceding line", ->
editSession.setCursorBufferPosition([3, Infinity])
editSession.insertText('\n', autoIndent: true)
expect(editSession.indentationForBufferRow(4)).toBe editSession.indentationForBufferRow(3)
editSession.insertText(' }', autoIndent: true)
expect(editSession.indentationForBufferRow(4)).toBe editSession.indentationForBufferRow(3) - 1
describe "when the inserted text is whitespace", ->
it "does not auto-decreases the indentation", ->
editSession.setCursorBufferPosition([12, 0])
editSession.insertText(' ', autoIndent: true)
expect(editSession.lineForBufferRow(12)).toBe ' };'
editSession.insertText('\t\t', autoIndent: true)
expect(editSession.lineForBufferRow(12)).toBe ' \t\t};'
describe "when the inserted text is non-whitespace", ->
it "auto-decreases the indentation of the line to be one level below that of the preceding line", ->
editSession.setCursorBufferPosition([3, Infinity])
editSession.insertText('\n', autoIndent: true)
expect(editSession.indentationForBufferRow(4)).toBe editSession.indentationForBufferRow(3)
editSession.insertText(' }', autoIndent: true)
expect(editSession.indentationForBufferRow(4)).toBe editSession.indentationForBufferRow(3) - 1
describe "when the current line does not match an auto-outdent pattern", ->
it "leaves the line unchanged", ->

View File

@@ -62,10 +62,14 @@ describe "CSON", ->
it "formats the undefined value as null", ->
expect(CSON.stringify(['a', undefined, 'b'])).toBe "[\n 'a'\n null\n 'b'\n]"
describe "when the array contains an object", ->
it "wraps the object in {}", ->
expect(CSON.stringify([{a:'b', a1: 'b1'}, {c: 'd'}])).toBe "[\n {\n 'a': 'b'\n 'a1': 'b1'\n }\n {\n 'c': 'd'\n }\n]"
describe "when formatting an object", ->
describe "when the object is empty", ->
it "returns the empty string", ->
expect(CSON.stringify({})).toBe ""
it "returns {}", ->
expect(CSON.stringify({})).toBe "{}"
it "returns formatted CSON", ->
expect(CSON.stringify(a: {b: 'c'})).toBe "'a':\n 'b': 'c'"

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