mirror of
https://github.com/atom/atom.git
synced 2026-01-23 05:48:10 -05:00
Merge remote-tracking branch 'origin/dev' into cefode
This commit is contained in:
Binary file not shown.
@@ -370,6 +370,7 @@ namespace v8_extensions {
|
||||
};
|
||||
|
||||
Git::Git() : CefV8Handler() {
|
||||
git_threads_init();
|
||||
}
|
||||
|
||||
void Git::CreateContextBinding(CefRefPtr<CefV8Context> context) {
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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]])
|
||||
|
||||
@@ -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", ->
|
||||
|
||||
@@ -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'"
|
||||
|
||||
@@ -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