Skip to content

Commit

Permalink
fix: make drawGutterDecoration a free function
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya committed Jan 2, 2021
1 parent 404393d commit 30e9017
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions lib/mixins/canvas-drawer.js
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ export default class CanvasDrawer extends Mixin {
renderData.screenRow = screenRow

this.drawDecorations(screenRow, decorations, renderData, {
gutter: this.drawGutterDecoration,
gutter: drawGutterDecoration,
'highlight-over': drawHighlightDecoration,
'highlight-outline': drawHighlightOutlineDecoration,
'foreground-custom': this.drawCustomDecoration
Expand Down Expand Up @@ -511,19 +511,6 @@ export default class CanvasDrawer extends Mixin {
data.context.fillRect(0, data.yRow, data.canvasWidth, data.lineHeight)
}

/**
* Draws a gutter decoration.
*
* @param {Decoration} decoration the decoration to render
* @param {Object} data the data need to perform the render
* @param {string} decorationColor decoration color
* @access private
*/
drawGutterDecoration (decoration, data, decorationColor) {
data.context.fillStyle = decorationColor
data.context.fillRect(0, data.yRow, 1, data.lineHeight)
}

/**
* Draws a custom decoration.
*
Expand All @@ -548,6 +535,7 @@ export default class CanvasDrawer extends Mixin {
const SPEC_MODE = atom.inSpecMode()
if (SPEC_MODE) {
// class methods only used for spying the calls
CanvasDrawer.drawGutterDecoration = drawGutterDecoration
CanvasDrawer.drawHighlightDecoration = drawHighlightDecoration
CanvasDrawer.drawHighlightOutlineDecoration = drawHighlightOutlineDecoration
}
Expand Down Expand Up @@ -655,6 +643,19 @@ function getInvisibleRegExp (editor) {
}
}

/**
* Draws a gutter decoration.
*
* @param {Decoration} decoration the decoration to render
* @param {Object} data the data need to perform the render
* @param {string} decorationColor decoration color
* @access private
*/
function drawGutterDecoration (decoration, data, decorationColor) {
data.context.fillStyle = decorationColor
data.context.fillRect(0, data.yRow, 1, data.lineHeight)
}

/**
* Draws a highlight decoration.
*
Expand Down

0 comments on commit 30e9017

Please sign in to comment.