Store column position as field

This commit is contained in:
Kevin Sawicki
2012-09-19 15:41:21 -07:00
parent b18627ab9b
commit a269eb39d0
2 changed files with 5 additions and 3 deletions

View File

@@ -23,8 +23,8 @@ describe "WrapGuide", ->
expect(rootView.panes.find('.lines > .wrap-guide').length).toBe 2
describe "@updateGuide", ->
it "positions the guide at 80 characters", ->
width = editor.charWidth * 80
it "positions the guide at the configured column", ->
width = editor.charWidth * wrapGuide.column
expect(width).toBeGreaterThan(0)
expect(wrapGuide.position().left).toBe(width)

View File

@@ -18,11 +18,13 @@ class WrapGuide extends View
@content: ->
@div class: 'wrap-guide'
column: 80
initialize: (@rootView, @editor) =>
@updateGuide(@editor)
@editor.on 'editor-path-change', => @updateGuide(@editor)
@rootView.on 'font-size-change', => @updateGuide(@editor)
updateGuide: (editor) ->
width = editor.charWidth * 80
width = editor.charWidth * @column
@css("left", width + "px")