diff --git a/spec/app/editor-spec.coffee b/spec/app/editor-spec.coffee index 9dcffb4cf..753aa7c85 100644 --- a/spec/app/editor-spec.coffee +++ b/spec/app/editor-spec.coffee @@ -1730,6 +1730,11 @@ describe "Editor", -> fold.destroy() expect(editor.gutter.find('.line-number').length).toBe 13 + it "styles folded line numbers", -> + editor.createFold(3, 5) + expect(editor.gutter.find('.line-number.fold').length).toBe 1 + expect(editor.gutter.find('.line-number.fold:eq(0)').text()).toBe '4' + describe "when the scrollView is scrolled to the right", -> it "adds a drop shadow to the gutter", -> editor.attachToDom() diff --git a/src/app/edit-session.coffee b/src/app/edit-session.coffee index 12adae4d6..f0be412a5 100644 --- a/src/app/edit-session.coffee +++ b/src/app/edit-session.coffee @@ -307,6 +307,10 @@ class EditSession fold.destroy() @setCursorBufferPosition([fold.startRow, 0]) + isFoldedAtBufferRow: (bufferRow) -> + screenRow = @screenPositionForBufferPosition([bufferRow]).row + @isFoldedAtScreenRow(screenRow) + isFoldedAtScreenRow: (screenRow) -> @lineForScreenRow(screenRow)?.fold? diff --git a/src/app/editor.coffee b/src/app/editor.coffee index 7d4ee0382..6daf0f276 100644 --- a/src/app/editor.coffee +++ b/src/app/editor.coffee @@ -276,6 +276,7 @@ class Editor extends View destroyFold: (foldId) -> @activeEditSession.destroyFold(foldId) destroyFoldsContainingBufferRow: (bufferRow) -> @activeEditSession.destroyFoldsContainingBufferRow(bufferRow) isFoldedAtScreenRow: (screenRow) -> @activeEditSession.isFoldedAtScreenRow(screenRow) + isFoldedAtBufferRow: (bufferRow) -> @activeEditSession.isFoldedAtBufferRow(bufferRow) lineForScreenRow: (screenRow) -> @activeEditSession.lineForScreenRow(screenRow) linesForScreenRows: (start, end) -> @activeEditSession.linesForScreenRows(start, end) diff --git a/src/app/gutter.coffee b/src/app/gutter.coffee index e1e2f8a82..9f7de8f7a 100644 --- a/src/app/gutter.coffee +++ b/src/app/gutter.coffee @@ -58,16 +58,19 @@ class Gutter extends View @renderLineNumbers(renderFrom, renderTo) if performUpdate renderLineNumbers: (startScreenRow, endScreenRow) -> - rows = @editor().bufferRowsForScreenRows(startScreenRow, endScreenRow) + editor = @editor() + rows = editor.bufferRowsForScreenRows(startScreenRow, endScreenRow) - cursorScreenRow = @editor().getCursorScreenPosition().row + cursorScreenRow = editor.getCursorScreenPosition().row @lineNumbers[0].innerHTML = $$$ -> for row in rows if row == lastScreenRow rowValue = '•' else rowValue = row + 1 - @div {class: 'line-number'}, rowValue + classes = ['line-number'] + classes.push('fold') if editor.isFoldedAtBufferRow(row) + @div rowValue, class: classes.join(' ') lastScreenRow = row @calculateWidth() diff --git a/themes/Atom - Dark/editor.css b/themes/Atom - Dark/editor.css index a9a8429d7..64d73ff3b 100644 --- a/themes/Atom - Dark/editor.css +++ b/themes/Atom - Dark/editor.css @@ -43,10 +43,19 @@ -webkit-animation-iteration-count: 1; } -.editor .fold { +.editor .line.fold { background-color: #444; } +.editor .gutter .line-number.fold { + color: #FBA0E3; + opacity: .75; +} + +.editor .gutter .line-number.fold.cursor-line { + opacity: 1; +} + .editor .fold.selected { background-color: #244; } diff --git a/themes/Atom - Light/editor.css b/themes/Atom - Light/editor.css index 9326721b9..ae5837c62 100644 --- a/themes/Atom - Light/editor.css +++ b/themes/Atom - Light/editor.css @@ -46,10 +46,19 @@ -webkit-animation-iteration-count: 1; } -.editor .fold { +.editor .line.fold { background-color: #444; } +.editor .gutter .line-number.fold { + color: #FBA0E3; + opacity: .75; +} + +.editor .gutter .line-number.fold.cursor-line { + opacity: 1; +} + .editor .fold.selected { background-color: #244; }