From 1ad2608f3c56a96ff6bbecfd8c12f3e32592d6e0 Mon Sep 17 00:00:00 2001 From: abe33 Date: Sun, 6 Dec 2015 17:21:53 +0100 Subject: [PATCH] Fix linter errors in legacy adapter --- lib/adapters/legacy-adapter.js | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/lib/adapters/legacy-adapter.js b/lib/adapters/legacy-adapter.js index e69c285a..37dc4a27 100644 --- a/lib/adapters/legacy-adapter.js +++ b/lib/adapters/legacy-adapter.js @@ -4,11 +4,11 @@ * @access private */ export default class LegacyAdater { - constructor(textEditor) { this.textEditor = textEditor } + constructor (textEditor) { this.textEditor = textEditor } - enableCache() { this.useCache = true } + enableCache () { this.useCache = true } - clearCache() { + clearCache () { this.useCache = false delete this.heightCache delete this.scrollTopCache @@ -16,15 +16,15 @@ export default class LegacyAdater { delete this.maxScrollTopCache } - onDidChangeScrollTop(callback) { + onDidChangeScrollTop (callback) { return this.textEditor.onDidChangeScrollTop(callback) } - onDidChangeScrollLeft(callback) { + onDidChangeScrollLeft (callback) { return this.textEditor.onDidChangeScrollLeft(callback) } - getHeight() { + getHeight () { if (this.useCache) { if (!this.heightCache) { this.heightCache = this.textEditor.getHeight() @@ -34,8 +34,8 @@ export default class LegacyAdater { return this.textEditor.getHeight() } - getScrollTop() { - if(this.useCache) { + getScrollTop () { + if (this.useCache) { if (!this.scrollTopCache) { this.scrollTopCache = this.textEditor.getScrollTop() } @@ -44,12 +44,12 @@ export default class LegacyAdater { return this.textEditor.getScrollTop() } - setScrollTop(scrollTop) { + setScrollTop (scrollTop) { return this.textEditor.setScrollTop(scrollTop) } - getScrollLeft() { - if(this.useCache) { + getScrollLeft () { + if (this.useCache) { if (!this.scrollLeftCache) { this.scrollLeftCache = this.textEditor.getScrollLeft() } @@ -59,13 +59,17 @@ export default class LegacyAdater { return this.textEditor.getScrollLeft() } - getMaxScrollTop() { - if ((this.maxScrollTopCache != null) && this.useCache) { return this.maxScrollTopCache } + getMaxScrollTop () { + if (this.maxScrollTopCache != null && this.useCache) { + return this.maxScrollTopCache + } var maxScrollTop = this.textEditor.displayBuffer.getMaxScrollTop() var lineHeight = this.textEditor.getLineHeightInPixels() - if (this.scrollPastEnd) { maxScrollTop -= this.getHeight() - 3 * lineHeight } - if (this.useCache) { return this.maxScrollTopCache = maxScrollTop } + if (this.scrollPastEnd) { + maxScrollTop -= this.getHeight() - 3 * lineHeight + } + if (this.useCache) { this.maxScrollTopCache = maxScrollTop } return maxScrollTop } }