mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Store column position as field
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user