Remove softWrap decoration option

This commit is contained in:
Ben Ogle
2014-06-17 11:24:27 -07:00
parent a3784500ec
commit ef09fbbfb2
2 changed files with 27 additions and 2 deletions

View File

@@ -540,6 +540,31 @@ describe "EditorComponent", ->
expect(lineNumberHasClass(3, 'someclass')).toBe false
expect(lineNumberHasClass(4, 'someclass')).toBe false
describe "when soft wrapping is enabled", ->
beforeEach ->
editor.setText "a line that wraps, ok"
editor.setSoftWrap(true)
node.style.width = 16 * charWidth + 'px'
component.measureScrollView()
it "applies decoration only to the first row when marker range does not wrap", ->
marker = editor.displayBuffer.markBufferRange([[0, 0], [0, 0]])
editor.addDecorationForMarker(marker, type: 'gutter', class: 'someclass')
waitsFor -> not component.decorationChangedImmediate?
runs ->
expect(lineNumberHasClass(0, 'someclass')).toBe true
expect(lineNumberHasClass(1, 'someclass')).toBe false
it "applies decoration to both rows when marker wraps", ->
marker = editor.displayBuffer.markBufferRange([[0, 0], [0, Infinity]])
editor.addDecorationForMarker(marker, type: 'gutter', class: 'someclass')
waitsFor -> not component.decorationChangedImmediate?
runs ->
expect(lineNumberHasClass(0, 'someclass')).toBe true
expect(lineNumberHasClass(1, 'someclass')).toBe true
describe "cursor rendering", ->
it "renders the currently visible cursors, translated relative to the scroll position", ->
cursor1 = editor.getCursor()

View File

@@ -139,7 +139,7 @@ GutterComponent = React.createClass
if decorations?
for decoration in decorations
if Decoration.isType(decoration, 'gutter')
classes += decoration.class + ' ' if not softWrapped or softWrapped and decoration.softWrap
classes += decoration.class + ' '
classes += "foldable " if bufferRow >= 0 and editor.isFoldableAtBufferRow(bufferRow)
classes += "line-number line-number-#{bufferRow}"
@@ -172,7 +172,7 @@ GutterComponent = React.createClass
if decorations?
for decoration in decorations
if Decoration.isType(decoration, 'gutter') and not contains(previousDecorations, decoration) and (not softWrapped or softWrapped and decoration.softWrap)
if Decoration.isType(decoration, 'gutter') and not contains(previousDecorations, decoration)
node.classList.add(decoration.class)
unless @screenRowsByLineNumberId[lineNumberId] is screenRow