diff --git a/src/app/cursor.coffee b/src/app/cursor.coffee index e2905fdb7..c06b85b5b 100644 --- a/src/app/cursor.coffee +++ b/src/app/cursor.coffee @@ -17,6 +17,7 @@ class Cursor ### # Internal # ### + constructor: ({@editSession, @marker}) -> @updateVisibility() @editSession.observeMarker @marker, (e) => diff --git a/src/app/edit-session.coffee b/src/app/edit-session.coffee index b5aea4e02..68fb53a8d 100644 --- a/src/app/edit-session.coffee +++ b/src/app/edit-session.coffee @@ -162,14 +162,17 @@ class EditSession # # softWrapColumn - A {Number} defining the soft wrap limit setSoftWrapColumn: (@softWrapColumn) -> @displayBuffer.setSoftWrapColumn(@softWrapColumn) + # Public: Defines whether to use soft tabs. # # softTabs - A {Boolean} which, if `true`, indicates that you want soft tabs. setSoftTabs: (@softTabs) -> + # Public: Retrieves whether soft tabs are enabled. # # Returns a {Boolean}. getSoftWrap: -> @softWrap + # Public: Defines whether to use soft wrapping of text. # # softTabs - A {Boolean} which, if `true`, indicates that you want soft wraps. @@ -256,14 +259,17 @@ class EditSession # Public: Saves the buffer. save: -> @buffer.save() + # Public: Saves the buffer at a specific path. # # path - The path to save at. saveAs: (path) -> @buffer.saveAs(path) + # Public: Retrieves the current buffer's file extension. # # Returns a {String}. getFileExtension: -> @buffer.getExtension() + # Public: Retrieves the current buffer's file path. # # Returns a {String}. @@ -283,30 +289,36 @@ class EditSession # # Returns a {String}. getBuffer: -> @buffer + # Public: Retrieves the current buffer's URI. # # Returns a {String}. getUri: -> @getPath() + # Public: Given a buffer row, identifies if it is blank. # # bufferRow - A buffer row {Number} to check # # Returns a {Boolean}. isBufferRowBlank: (bufferRow) -> @buffer.isRowBlank(bufferRow) + # Public: Given a buffer row, this finds the next row that's blank. # # bufferRow - A buffer row {Number} to check # # Returns a {Number}, or `null` if there's no other blank row. nextNonBlankBufferRow: (bufferRow) -> @buffer.nextNonBlankRow(bufferRow) + # Public: Finds the last point in the current buffer. # # Returns a {Point} representing the last position. getEofBufferPosition: -> @buffer.getEofPosition() + # Public: Finds the last line in the current buffer. # # Returns a {Number}. getLastBufferRow: -> @buffer.getLastRow() + # Public: Given a buffer row, this retrieves the range for that line. # # row - A {Number} identifying the row @@ -315,34 +327,40 @@ class EditSession # # Returns a {Range}. bufferRangeForBufferRow: (row, options) -> @buffer.rangeForRow(row, options) + # Public: Given a buffer row, this retrieves that line. # # row - A {Number} identifying the row # # Returns a {String}. lineForBufferRow: (row) -> @buffer.lineForRow(row) + # Public: Given a buffer row, this retrieves that line's length. # # row - A {Number} identifying the row # # Returns a {Number}. lineLengthForBufferRow: (row) -> @buffer.lineLengthForRow(row) + # Public: Scans for text in the buffer, calling a function on each match. # # regex - A {RegExp} representing the text to find # range - A {Range} in the buffer to search within # iterator - A {Function} that's called on each match scanInBufferRange: (args...) -> @buffer.scanInRange(args...) + # Public: Scans for text in the buffer _backwards_, calling a function on each match. # # regex - A {RegExp} representing the text to find # range - A {Range} in the buffer to search within # iterator - A {Function} that's called on each match backwardsScanInBufferRange: (args...) -> @buffer.backwardsScanInRange(args...) + # Public: Identifies if the {Buffer} is modified (and not saved). # # Returns a {Boolean}. isModified: -> @buffer.isModified() + # Public: Identifies if the modified buffer should let you know if it's closing # without being saved. # @@ -394,12 +412,14 @@ class EditSession # # Returns the new, clipped {Point}. Note that this could be the same as `position` if no clipping was performed. clipScreenPosition: (screenPosition, options) -> @displayBuffer.clipScreenPosition(screenPosition, options) + # Public: Gets the line for the given screen row. # # screenRow - A {Number} indicating the screen row. # # Returns a {String}. lineForScreenRow: (row) -> @displayBuffer.lineForRow(row) + # Public: Gets the lines for the given screen row boundaries. # # start - A {Number} indicating the beginning screen row. @@ -407,18 +427,22 @@ class EditSession # # Returns an {Array} of {String}s. linesForScreenRows: (start, end) -> @displayBuffer.linesForRows(start, end) + # Public: Gets the number of screen rows. # # Returns a {Number}. getScreenLineCount: -> @displayBuffer.getLineCount() + # Public: Gets the length of the longest screen line. # # Returns a {Number}. maxScreenLineLength: -> @displayBuffer.maxLineLength() + # Public: Gets the number of the last row in the buffer. # # Returns a {Number}. getLastScreenRow: -> @displayBuffer.getLastRow() + # Public: Given a starting and ending row, this converts every row into a buffer position. # # startRow - The row {Number} to start at @@ -426,22 +450,26 @@ class EditSession # # Returns an {Array} of {Range}s. bufferRowsForScreenRows: (startRow, endRow) -> @displayBuffer.bufferRowsForScreenRows(startRow, endRow) + # Public: Retrieves the grammar's token scopes for a buffer position. # # bufferPosition - A {Point} in the {Buffer} # # Returns an {Array} of {String}s. scopesForBufferPosition: (bufferPosition) -> @displayBuffer.scopesForBufferPosition(bufferPosition) + # Public: Retrieves the grammar's token for a buffer position. # # bufferPosition - A {Point} in the {Buffer} # # Returns a {Token}. tokenForBufferPosition: (bufferPosition) -> @displayBuffer.tokenForBufferPosition(bufferPosition) + # Public: Retrieves the grammar's token scopes for the line with the most recently added cursor. # # Returns an {Array} of {String}s. getCursorScopes: -> @getCursor().getScopes() + # Internal: logScreenLines: (start, end) -> @displayBuffer.logLines(start, end) diff --git a/src/app/editor.coffee b/src/app/editor.coffee index 2ad8c1294..9be9022f9 100644 --- a/src/app/editor.coffee +++ b/src/app/editor.coffee @@ -196,137 +196,173 @@ class Editor extends View # # Returns a {Cursor}. getCursor: -> @activeEditSession.getCursor() + # Public: Retrieves an array of all the cursors. # # Returns a {[Cursor]}. getCursors: -> @activeEditSession.getCursors() + # Public: Adds a cursor at the provided `screenPosition`. # # screenPosition - An {Array} of two numbers: the screen row, and the screen column. # # Returns the new {Cursor}. addCursorAtScreenPosition: (screenPosition) -> @activeEditSession.addCursorAtScreenPosition(screenPosition) + # Public: Adds a cursor at the provided `bufferPosition`. # # bufferPosition - An {Array} of two numbers: the buffer row, and the buffer column. # # Returns the new {Cursor}. addCursorAtBufferPosition: (bufferPosition) -> @activeEditSession.addCursorAtBufferPosition(bufferPosition) + # Public: Moves every cursor up one row. moveCursorUp: -> @activeEditSession.moveCursorUp() + # Public: Moves every cursor down one row. moveCursorDown: -> @activeEditSession.moveCursorDown() + # Public: Moves every cursor left one column. moveCursorLeft: -> @activeEditSession.moveCursorLeft() + # Public: Moves every cursor right one column. moveCursorRight: -> @activeEditSession.moveCursorRight() + # Public: Moves every cursor to the beginning of the current word. moveCursorToBeginningOfWord: -> @activeEditSession.moveCursorToBeginningOfWord() + # Public: Moves every cursor to the end of the current word. moveCursorToEndOfWord: -> @activeEditSession.moveCursorToEndOfWord() + # Public: Moves the cursor to the beginning of the next word. moveCursorToBeginningOfNextWord: -> @activeEditSession.moveCursorToBeginningOfNextWord() + # Public: Moves every cursor to the top of the buffer. moveCursorToTop: -> @activeEditSession.moveCursorToTop() + # Public: Moves every cursor to the bottom of the buffer. moveCursorToBottom: -> @activeEditSession.moveCursorToBottom() + # Public: Moves every cursor to the beginning of the line. moveCursorToBeginningOfLine: -> @activeEditSession.moveCursorToBeginningOfLine() + # Public: Moves every cursor to the first non-whitespace character of the line. moveCursorToFirstCharacterOfLine: -> @activeEditSession.moveCursorToFirstCharacterOfLine() + # Public: Moves every cursor to the end of the line. moveCursorToEndOfLine: -> @activeEditSession.moveCursorToEndOfLine() + # Public: Moves the selected line up one row. moveLineUp: -> @activeEditSession.moveLineUp() + # Public: Moves the selected line down one row. moveLineDown: -> @activeEditSession.moveLineDown() + # Public: Sets the cursor based on a given screen position. # # position - An {Array} of two numbers: the screen row, and the screen column. # options - An object with properties based on {Cursor.setScreenPosition}. # setCursorScreenPosition: (position, options) -> @activeEditSession.setCursorScreenPosition(position, options) + # Public: Duplicates the current line. # # If more than one cursor is present, only the most recently added one is considered. duplicateLine: -> @activeEditSession.duplicateLine() + # Public: Joins the current line with the one below it. # # Multiple cursors are considered equally. If there's a selection in the editor, # all the lines are joined together. joinLine: -> @activeEditSession.joinLine() + # Public: Gets the current screen position. # # Returns an {Array} of two numbers: the screen row, and the screen column. getCursorScreenPosition: -> @activeEditSession.getCursorScreenPosition() + # Public: Gets the current screen row. # # Returns a {Number}. getCursorScreenRow: -> @activeEditSession.getCursorScreenRow() + # Public: Sets the cursor based on a given buffer position. # # position - An {Array} of two numbers: the buffer row, and the buffer column. # options - An object with properties based on {Cursor.setBufferPosition}. # setCursorBufferPosition: (position, options) -> @activeEditSession.setCursorBufferPosition(position, options) + # Public: Gets the current buffer position of the cursor. # # Returns an {Array} of two numbers: the buffer row, and the buffer column. getCursorBufferPosition: -> @activeEditSession.getCursorBufferPosition() + # Public: Retrieves the range for the current paragraph. # # A paragraph is defined as a block of text surrounded by empty lines. # # Returns a {Range}. getCurrentParagraphBufferRange: -> @activeEditSession.getCurrentParagraphBufferRange() + # Public: Gets the word located under the cursor. # # options - An object with properties based on {Cursor.getBeginningOfCurrentWordBufferPosition}. # # Returns a {String}. getWordUnderCursor: (options) -> @activeEditSession.getWordUnderCursor(options) + # Public: Gets the selection at the specified index. # # index - The id {Number} of the selection # # Returns a {Selection}. getSelection: (index) -> @activeEditSession.getSelection(index) + # Public: Gets the last selection, _i.e._ the most recently added. # # Returns a {Selection}. getSelections: -> @activeEditSession.getSelections() + # Public: Gets all selections, ordered by their position in the buffer. # # Returns an {Array} of {Selection}s. getSelectionsOrderedByBufferPosition: -> @activeEditSession.getSelectionsOrderedByBufferPosition() + # Public: Gets the very last selection, as it's ordered in the buffer. # # Returns a {Selection}. getLastSelectionInBuffer: -> @activeEditSession.getLastSelectionInBuffer() + # Public: Gets the currently selected text. # # Returns a {String}. getSelectedText: -> @activeEditSession.getSelectedText() + # Public: Gets the buffer ranges of all the {Selection}s. # # This is ordered by their buffer position. # # Returns an {Array} of {Range}s. getSelectedBufferRanges: -> @activeEditSession.getSelectedBufferRanges() + # Public: Gets the buffer range of the most recently added {Selection}. # # Returns a {Range}. getSelectedBufferRange: -> @activeEditSession.getSelectedBufferRange() + # Public: Given a buffer range, this removes all previous selections and creates a new selection for it. # # bufferRange - A {Range} in the buffer # options - A hash of options setSelectedBufferRange: (bufferRange, options) -> @activeEditSession.setSelectedBufferRange(bufferRange, options) + # Public: Given an array of buffer ranges, this removes all previous selections and creates new selections for them. # # bufferRanges - An {Array} of {Range}s in the buffer # options - A hash of options setSelectedBufferRanges: (bufferRanges, options) -> @activeEditSession.setSelectedBufferRanges(bufferRanges, options) + # Public: Given a buffer range, this adds a new selection for it. # # bufferRange - A {Range} in the buffer @@ -334,38 +370,55 @@ class Editor extends View # # Returns the new {Selection}. addSelectionForBufferRange: (bufferRange, options) -> @activeEditSession.addSelectionForBufferRange(bufferRange, options) + # Public: Selects the text one position right of the cursor. selectRight: -> @activeEditSession.selectRight() + # Public: Selects the text one position left of the cursor. selectLeft: -> @activeEditSession.selectLeft() + # Public: Selects all the text one position above the cursor. selectUp: -> @activeEditSession.selectUp() + # Public: Selects all the text one position below the cursor. selectDown: -> @activeEditSession.selectDown() + # Public: Selects all the text from the current cursor position to the top of the buffer. selectToTop: -> @activeEditSession.selectToTop() + # Public: Selects all the text from the current cursor position to the bottom of the buffer. selectToBottom: -> @activeEditSession.selectToBottom() + # Public: Selects all the text in the buffer. selectAll: -> @activeEditSession.selectAll() + # Public: Selects all the text from the current cursor position to the beginning of the line. selectToBeginningOfLine: -> @activeEditSession.selectToBeginningOfLine() + # Public: Selects all the text from the current cursor position to the end of the line. selectToEndOfLine: -> @activeEditSession.selectToEndOfLine() + # Public: Moves the current selection down one row. addSelectionBelow: -> @activeEditSession.addSelectionBelow() + # Public: Moves the current selection up one row. addSelectionAbove: -> @activeEditSession.addSelectionAbove() + # Public: Selects all the text from the current cursor position to the beginning of the word. selectToBeginningOfWord: -> @activeEditSession.selectToBeginningOfWord() + # Public: Selects all the text from the current cursor position to the end of the word. selectToEndOfWord: -> @activeEditSession.selectToEndOfWord() + # Public: Selects all the text from the current cursor position to the beginning of the next word. selectToBeginningOfNextWord: -> @activeEditSession.selectToBeginningOfNextWord() + # Public: Selects the current word. selectWord: -> @activeEditSession.selectWord() + # Public: Selects the current line. selectLine: -> @activeEditSession.selectLine() + # Public: Selects the text from the current cursor position to a given position. # # position - An instance of {Point}, with a given `row` and `column`. @@ -376,64 +429,89 @@ class Editor extends View # to the position of the selection after it. The last selection is transferred to the # position of the first. transpose: -> @activeEditSession.transpose() + # Public: Turns the current selection into upper case. upperCase: -> @activeEditSession.upperCase() + # Public: Turns the current selection into lower case. lowerCase: -> @activeEditSession.lowerCase() + # Public: Clears every selection. TODO clearSelections: -> @activeEditSession.clearSelections() # Public: Performs a backspace, removing the character found behind the cursor position. backspace: -> @activeEditSession.backspace() + # Public: Performs a backspace to the beginning of the current word, removing characters found there. backspaceToBeginningOfWord: -> @activeEditSession.backspaceToBeginningOfWord() + # Public: Performs a backspace to the beginning of the current line, removing characters found there. backspaceToBeginningOfLine: -> @activeEditSession.backspaceToBeginningOfLine() + # Public: Performs a delete, removing the character found ahead the cursor position. delete: -> @activeEditSession.delete() + # Public: Performs a delete to the end of the current word, removing characters found there. deleteToEndOfWord: -> @activeEditSession.deleteToEndOfWord() + # Public: Performs a delete to the end of the current line, removing characters found there. deleteLine: -> @activeEditSession.deleteLine() + # Public: Performs a cut to the end of the current line. # # Characters are removed, but the text remains in the clipboard. cutToEndOfLine: -> @activeEditSession.cutToEndOfLine() + # Public: Inserts text at the current cursor positions. # # text - A {String} representing the text to insert. # options - A set of options equivalent to {Selection.insertText}. insertText: (text, options) -> @activeEditSession.insertText(text, options) + # Public: Inserts a new line at the current cursor positions. insertNewline: -> @activeEditSession.insertNewline() + # Internal: + consolidateSelections: (e) -> e.abortKeyBinding() unless @activeEditSession.consolidateSelections() + # Public: Inserts a new line below the current cursor positions. insertNewlineBelow: -> @activeEditSession.insertNewlineBelow() + # Public: Inserts a new line above the current cursor positions. insertNewlineAbove: -> @activeEditSession.insertNewlineAbove() + # Public: Indents the current line. # # options - A set of options equivalent to {Selection.indent}. indent: (options) -> @activeEditSession.indent(options) + # Public: TODO autoIndent: (options) -> @activeEditSession.autoIndentSelectedRows() + # Public: Indents the selected rows. indentSelectedRows: -> @activeEditSession.indentSelectedRows() + # Public: Outdents the selected rows. outdentSelectedRows: -> @activeEditSession.outdentSelectedRows() + # Public: Cuts the selected text. cutSelection: -> @activeEditSession.cutSelectedText() + # Public: Copies the selected text. copySelection: -> @activeEditSession.copySelectedText() + # Public: Pastes the text in the clipboard. # # options - A set of options equivalent to {Selection.insertText}. paste: (options) -> @activeEditSession.pasteText(options) + # Public: Undos the last {Buffer} change. undo: -> @activeEditSession.undo() + # Public: Redos the last {Buffer} change. redo: -> @activeEditSession.redo() + # Public: Creates a new fold between two row numbers. # # startRow - The row {Number} to start folding at @@ -441,36 +519,46 @@ class Editor extends View # # Returns the new {Fold}. createFold: (startRow, endRow) -> @activeEditSession.createFold(startRow, endRow) + # Public: Folds the current row. foldCurrentRow: -> @activeEditSession.foldCurrentRow() + # Public: Unfolds the current row. unfoldCurrentRow: -> @activeEditSession.unfoldCurrentRow() + # Public: Folds all the rows. foldAll: -> @activeEditSession.foldAll() + # Public: Unfolds all the rows. unfoldAll: -> @activeEditSession.unfoldAll() + # Public: Folds the most recent selection. foldSelection: -> @activeEditSession.foldSelection() + # Public: Given the id of a {Fold}, this removes it. # # foldId - The fold id {Number} to remove destroyFold: (foldId) -> @activeEditSession.destroyFold(foldId) + # Public: Removes any {Fold}s found that contain the given buffer row. # # bufferRow - The buffer row {Number} to check against destroyFoldsContainingBufferRow: (bufferRow) -> @activeEditSession.destroyFoldsContainingBufferRow(bufferRow) + # Public: Determines if the given screen row is folded. # # screenRow - A {Number} indicating the screen row. # # Returns `true` if the screen row is folded, `false` otherwise. isFoldedAtScreenRow: (screenRow) -> @activeEditSession.isFoldedAtScreenRow(screenRow) + # Public: Determines if the given buffer row is folded. # # screenRow - A {Number} indicating the buffer row. # # Returns `true` if the buffer row is folded, `false` otherwise. isFoldedAtBufferRow: (bufferRow) -> @activeEditSession.isFoldedAtBufferRow(bufferRow) + # Public: Determines if the given row that the cursor is at is folded. # # Returns `true` if the row is folded, `false` otherwise. @@ -482,6 +570,7 @@ class Editor extends View # # Returns a {String}. lineForScreenRow: (screenRow) -> @activeEditSession.lineForScreenRow(screenRow) + # Public: Gets the lines for the given screen row boundaries. # # start - A {Number} indicating the beginning screen row. @@ -489,24 +578,29 @@ class Editor extends View # # Returns an {Array} of {String}s. linesForScreenRows: (start, end) -> @activeEditSession.linesForScreenRows(start, end) + # Public: Gets the number of screen rows. # # Returns a {Number}. getScreenLineCount: -> @activeEditSession.getScreenLineCount() + # Public: Defines the limit at which the buffer begins to soft wrap text. # # softWrapColumn - A {Number} defining the soft wrap limit setSoftWrapColumn: (softWrapColumn) -> softWrapColumn ?= @calcSoftWrapColumn() @activeEditSession.setSoftWrapColumn(softWrapColumn) if softWrapColumn + # Public: Gets the length of the longest screen line. # # Returns a {Number}. maxScreenLineLength: -> @activeEditSession.maxScreenLineLength() + # Public: Gets the text in the last screen row. # # Returns a {String}. getLastScreenRow: -> @activeEditSession.getLastScreenRow() + # Public: Given a position, this clips it to a real position. # # For example, if `position`'s row exceeds the row count of the buffer, @@ -553,6 +647,7 @@ class Editor extends View # # Returns a {Range}. bufferRangeForScreenRange: (range) -> @activeEditSession.bufferRangeForScreenRange(range) + # Public: Given a starting and ending row, this converts every row into a buffer position. # # startRow - The row {Number} to start at @@ -560,14 +655,18 @@ class Editor extends View # # Returns an {Array} of {Range}s. bufferRowsForScreenRows: (startRow, endRow) -> @activeEditSession.bufferRowsForScreenRows(startRow, endRow) + # Public: Gets the number of the last row in the buffer. # # Returns a {Number}. getLastScreenRow: -> @activeEditSession.getLastScreenRow() + # Internal: + logCursorScope: -> console.log @activeEditSession.getCursorScopes() - # Public: Emulates the "page down" key, where the last row of a buffer scrolls to become the first. + + # Public: Emulates the "page down" key, where the last row of a buffer scrolls to become the first. pageDown: -> newScrollTop = @scrollTop() + @scrollView[0].clientHeight @activeEditSession.moveCursorDown(@getPageRows()) @@ -618,48 +717,58 @@ class Editor extends View # Public: Checks out the current HEAD revision of the file. checkoutHead: -> @getBuffer().checkoutHead() + # Public: Replaces the current buffer contents. # # text - A {String} containing the new buffer contents. setText: (text) -> @activeEditSession.setText(text) + # Public: Retrieves the current buffer contents. # # Returns a {String}. getText: -> @activeEditSession.getText() + # Public: Retrieves the current buffer's file path. # # Returns a {String}. getPath: -> @activeEditSession?.getPath() + # Public: Gets the number of lines in a file. # # Returns a {Number}. getLineCount: -> @getBuffer().getLineCount() + # Public: Gets the row number of the last line. # # Returns a {Number}. getLastBufferRow: -> @getBuffer().getLastRow() + # Public: Given a range, returns the lines of text within it. # # range - A {Range} object specifying your points of interest # # Returns a {String} of the combined lines. getTextInRange: (range) -> @getBuffer().getTextInRange(range) + # Public: Finds the last point in the current buffer. # # Returns a {Point} representing the last position. getEofPosition: -> @getBuffer().getEofPosition() + # Public: Given a row, returns the line of text. # # row - A {Number} indicating the row. # # Returns a {String}. lineForBufferRow: (row) -> @getBuffer().lineForRow(row) + # Public: Given a row, returns the length of the line of text. # # row - A {Number} indicating the row # # Returns a {Number}. lineLengthForBufferRow: (row) -> @getBuffer().lineLengthForRow(row) + # Public: Given a buffer row, this retrieves the range for that line. # # row - A {Number} identifying the row @@ -668,12 +777,14 @@ class Editor extends View # # Returns a {Range}. rangeForBufferRow: (row) -> @getBuffer().rangeForRow(row) + # Public: Scans for text in the buffer, calling a function on each match. # # regex - A {RegExp} representing the text to find # range - A {Range} in the buffer to search within # iterator - A {Function} that's called on each match scanInBufferRange: (args...) -> @getBuffer().scanInRange(args...) + # Public: Scans for text in the buffer _backwards_, calling a function on each match. # # regex - A {RegExp} representing the text to find diff --git a/src/app/git.coffee b/src/app/git.coffee index 7c15a55ac..b83aa802f 100644 --- a/src/app/git.coffee +++ b/src/app/git.coffee @@ -10,6 +10,7 @@ GitUtils = require 'git-utils' # Ultimately, this is an overlay to the native [git-utils](https://github.com/atom/node-git) model. module.exports = class Git + # Public: Creates a new `Git` instance. # # path - The git repository to open @@ -98,7 +99,7 @@ class Git getWorkingDirectory: -> @getRepo().getWorkingDirectory() - # Public: Retrieves the reference or SHA-1 that `HEAD` points to. + # Public: Retrieves the reference or SHA-1 that `HEAD` points to. # # This can be `refs/heads/master`, or a full SHA-1 if the repository is in a detached `HEAD` state. # @@ -170,7 +171,7 @@ class Git relativize: (path) -> @getRepo().relativize(path) - # Public: Retrieves a shortened version of {.getHead}. + # Public: Retrieves a shortened version of {.getHead}. # # This removes the leading segments of `refs/heads`, `refs/tags`, or `refs/remotes`. # It also shortenes the SHA-1 of a detached `HEAD` to 7 characters. @@ -179,7 +180,7 @@ class Git getShortHead: -> @getRepo().getShortHead() - # Public: Restore the contents of a path in the working directory and index to the version at `HEAD`. + # Public: Restore the contents of a path in the working directory and index to the version at `HEAD`. # # This is essentially the same as running: # ``` @@ -239,7 +240,7 @@ class Git # # path - The {String} path (relative to the repository) # text - The {String} to compare against the `HEAD` contents - # + # # Returns an object with two keys, `ahead` and `behind`. These will always be greater than zero. getLineDiffs: (path, text) -> @getRepo().getLineDiffs(@relativize(path), text) @@ -259,6 +260,6 @@ class Git @statusTask.one 'task-completed', => @statusTask = null @statusTask.start() - + _.extend Git.prototype, Subscriber _.extend Git.prototype, EventEmitter diff --git a/src/app/line-map.coffee b/src/app/line-map.coffee index 163e85133..fbf0f3b67 100644 --- a/src/app/line-map.coffee +++ b/src/app/line-map.coffee @@ -139,6 +139,7 @@ class LineMap currentBufferRow = nextBufferRow [screenRow, screenLines] + # Public: Given a buffer range, this converts it into a screen position. # # screenPosition - An object that represents a buffer position. It can be either @@ -172,6 +173,7 @@ class LineMap start = @screenPositionForBufferPosition(bufferRange.start) end = @screenPositionForBufferPosition(bufferRange.end) new Range(start, end) + # Public: Given a screen range, this converts it into a buffer position. # # screenRange - The {Range} to convert diff --git a/src/app/range.coffee b/src/app/range.coffee index 2b82cc3bd..72e1ede1a 100644 --- a/src/app/range.coffee +++ b/src/app/range.coffee @@ -1,15 +1,16 @@ Point = require 'point' _ = require 'underscore' -# Public: Indicates a region within the editor. +# Public: Indicates a region within the editor. # # To better visualize how this works, imagine a rectangle. -# Each quadrant of the rectangle is analogus to a range, as ranges contain a +# Each quadrant of the rectangle is analogus to a range, as ranges contain a # starting row and a starting column, as well as an ending row, and an ending column. # # Each `Range` is actually constructed of two `Point` objects, labelled `start` and `end`. module.exports = class Range + # Public: Constructs a `Range` from a given object. # # object - This can be an {Array} (`[startRow, startColumn, endRow, endColumn]`) or an object `{start: Point, end: Point}` @@ -58,7 +59,7 @@ class Range # Public: Identifies if two `Range`s are equal. # - # All four points (`start.row`, `start.column`, `end.row`, `end.column`) must be + # All four points (`start.row`, `start.column`, `end.row`, `end.column`) must be # equal for this method to return `true`. # # other - A different {Range} to check against