mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-11-14 04:29:04 +03:00
Now we can force line wrapping in specs without editor being on the DOM.
This commit is contained in:
parent
06a3f3d376
commit
5709b0d152
@ -567,9 +567,7 @@ describe "Editor", ->
|
||||
|
||||
describe "when editing a line that spans multiple screen lines", ->
|
||||
beforeEach ->
|
||||
editor.attachToDom()
|
||||
editor.setSoftWrap(true)
|
||||
setEditorWidthInChars(editor, 50)
|
||||
editor.setSoftWrap(true, 50)
|
||||
|
||||
describe "when newline is inserted", ->
|
||||
it "indents cursor based on the indentation of previous buffer line", ->
|
||||
|
@ -236,20 +236,20 @@ class Editor extends View
|
||||
toggleSoftWrap: ->
|
||||
@setSoftWrap(not @softWrap)
|
||||
|
||||
setMaxLineLength: (maxLength) ->
|
||||
maxLength ?=
|
||||
setMaxLineLength: (maxLineLength) ->
|
||||
maxLineLength ?=
|
||||
if @softWrap
|
||||
Math.floor(@horizontalScroller.width() / @charWidth)
|
||||
else
|
||||
Infinity
|
||||
|
||||
@renderer.setMaxLineLength(maxLength) if maxLength
|
||||
@renderer.setMaxLineLength(maxLineLength) if maxLineLength
|
||||
|
||||
createFold: (range) ->
|
||||
@renderer.createFold(range)
|
||||
|
||||
setSoftWrap: (@softWrap) ->
|
||||
@setMaxLineLength()
|
||||
setSoftWrap: (@softWrap, maxLineLength=undefined) ->
|
||||
@setMaxLineLength(maxLineLength)
|
||||
if @softWrap
|
||||
@addClass 'soft-wrap'
|
||||
@_setMaxLineLength = => @setMaxLineLength()
|
||||
|
Loading…
Reference in New Issue
Block a user