From dd63d47c11a73f7bf438e1121d5eb9fa4927f02f Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Tue, 2 Dec 2014 15:58:54 -0700 Subject: [PATCH] =?UTF-8?q?Add=20getters=20for=20decoration=20types=20in?= =?UTF-8?q?=20addition=20to=20=E2=80=98overlay=E2=80=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/display-buffer.coffee | 9 +++++++++ src/text-editor.coffee | 18 ++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/src/display-buffer.coffee b/src/display-buffer.coffee index 5d8716284..2fec5c60a 100644 --- a/src/display-buffer.coffee +++ b/src/display-buffer.coffee @@ -889,6 +889,15 @@ class DisplayBuffer extends Model allDecorations = allDecorations.concat(decorations) if decorations? allDecorations + getLineDecorations: -> + @getDecorations().filter (decoration) -> decoration.isType('line') + + getGutterDecorations: -> + @getDecorations().filter (decoration) -> decoration.isType('gutter') + + getHighlightDecorations: -> + @getDecorations().filter (decoration) -> decoration.isType('highlight') + getOverlayDecorations: -> @getDecorations().filter (decoration) -> decoration.isType('overlay') diff --git a/src/text-editor.coffee b/src/text-editor.coffee index 5f3ff226b..c210f3eef 100644 --- a/src/text-editor.coffee +++ b/src/text-editor.coffee @@ -1314,6 +1314,24 @@ class TextEditor extends Model getDecorations: -> @displayBuffer.getDecorations() + # Extended: Get all decorations of type 'line'. + # + # Returns an {Array} of {Decoration}s. + getLineDecorations: -> + @displayBuffer.getLineDecorations() + + # Extended: Get all decorations of type 'gutter'. + # + # Returns an {Array} of {Decoration}s. + getGutterDecorations: -> + @displayBuffer.getGutterDecorations() + + # Extended: Get all decorations of type 'highlight'. + # + # Returns an {Array} of {Decoration}s. + getHighlightDecorations: -> + @displayBuffer.getHighlightDecorations() + # Extended: Get all decorations of type 'overlay'. # # Returns an {Array} of {Decoration}s.