This commit is contained in:
Corey Johnson & Nathan Sobo
2012-12-11 16:51:35 -08:00
10 changed files with 48 additions and 20 deletions

View File

@@ -497,7 +497,13 @@ class Editor extends View
scrollToBottom: ->
@scrollBottom(@screenLineCount() * @lineHeight)
scrollTo: (pixelPosition, options) ->
scrollToBufferPosition: (bufferPosition, options) ->
@scrollToPixelPosition(@pixelPositionForBufferPosition(bufferPosition), options)
scrollToScreenPosition: (screenPosition, options) ->
@scrollToPixelPosition(@pixelPositionForScreenPosition(screenPosition), options)
scrollToPixelPosition: (pixelPosition, options) ->
return unless @attached
@scrollVertically(pixelPosition, options)
@scrollHorizontally(pixelPosition)
@@ -800,11 +806,11 @@ class Editor extends View
autoscroll: (options={}) ->
for cursorView in @getCursorViews() when cursorView.needsAutoscroll()
@scrollTo(cursorView.getPixelPosition()) unless options.suppressAutoScroll
@scrollToPixelPosition(cursorView.getPixelPosition()) unless options.suppressAutoScroll
cursorView.autoscrolled()
for selectionView in @getSelectionViews() when selectionView.needsAutoscroll()
@scrollTo(selectionView.getCenterPixelPosition(), center: true)
@scrollToPixelPosition(selectionView.getCenterPixelPosition(), center: true)
selectionView.autoscrolled()
updateRenderedLines: ->
@@ -1025,6 +1031,9 @@ class Editor extends View
@renderedLines.find('.line').each (n) ->
console.log n, $(this).text()
pixelPositionForBufferPosition: (position) ->
@pixelPositionForScreenPosition(@screenPositionForBufferPosition(position))
pixelPositionForScreenPosition: (position) ->
position = Point.fromObject(position)
{ top: position.row * @lineHeight, left: position.column * @charWidth }

View File

@@ -19,7 +19,7 @@ class Git
getPath: -> @repo.getPath()
getWorkingDirectory: ->
repoPath = @repo.getPath()
repoPath = @getPath()
if repoPath
repoPath.substring(0, repoPath.length - 5)
@@ -35,11 +35,16 @@ class Git
isPathModified: (path) ->
modifiedFlags = @statusFlags.working_dir_modified |
@statusFlags.working_dir_delete |
@statusFlags.working_dir_typechange
@statusFlags.working_dir_typechange |
@statusFlags.index_modified |
@statusFlags.index_deleted |
@statusFlags.index_typechange
(@getPathStatus(path) & modifiedFlags) > 0
isPathNew: (path) ->
(@getPathStatus(path) & @statusFlags.working_dir_new) > 0
newFlags = @statusFlags.working_dir_new |
@statusFlags.index_new
(@getPathStatus(path) & newFlags) > 0
relativize: (path) ->
workingDirectory = @getWorkingDirectory()

View File

@@ -1,5 +1,6 @@
_ = require 'underscore'
{View, $$} = require 'space-pen'
$ = require 'jquery'
module.exports =
class StatusBar extends View
@@ -36,6 +37,7 @@ class StatusBar extends View
@updateCursorPositionText()
@editor.on 'cursor-move', => @updateCursorPositionText()
$(window).on 'focus', => @updateStatusBar()
@subscribeToBuffer()