Append wrap guide to editor element

This prevents unneeded horizontal scrollbars when
the wrap guide exceeds the buffer size and the
buffer doesn't have any 80 character or greater lines
This commit is contained in:
Kevin Sawicki 2012-09-26 16:21:49 -07:00
parent f95e67d8cd
commit 5301b29649
2 changed files with 4 additions and 4 deletions

View File

@ -17,10 +17,10 @@ describe "WrapGuide", ->
describe "@initialize", ->
it "appends a wrap guide to all existing and new editors", ->
expect(rootView.panes.find('.pane').length).toBe 1
expect(rootView.panes.find('.lines > .wrap-guide').length).toBe 1
expect(rootView.panes.find('.editor > .wrap-guide').length).toBe 1
editor.splitRight()
expect(rootView.find('.pane').length).toBe 2
expect(rootView.panes.find('.lines > .wrap-guide').length).toBe 2
expect(rootView.panes.find('.editor > .wrap-guide').length).toBe 2
describe "@updateGuide", ->
it "positions the guide at the configured column", ->

View File

@ -12,8 +12,8 @@ class WrapGuide extends View
@appendToEditorPane(rootView, editor)
@appendToEditorPane: (rootView, editor) ->
if lines = editor.pane()?.find('.lines')
lines.append(new WrapGuide(rootView, editor))
if parent = editor.pane()?.find('.editor')
parent.append(new WrapGuide(rootView, editor))
@content: ->
@div class: 'wrap-guide'