From 9451ca0254f11503682fc82db44c8596dec8dba7 Mon Sep 17 00:00:00 2001 From: Damien Guard Date: Tue, 30 Aug 2016 13:20:17 -0700 Subject: [PATCH] Fix show/hide line numbers in editor --- spec/text-editor-registry-spec.js | 13 +++++++++++++ src/text-editor-registry.js | 1 + 2 files changed, 14 insertions(+) diff --git a/spec/text-editor-registry-spec.js b/spec/text-editor-registry-spec.js index fc48c101c..812676305 100644 --- a/spec/text-editor-registry-spec.js +++ b/spec/text-editor-registry-spec.js @@ -425,6 +425,19 @@ describe('TextEditorRegistry', function () { expect(editor.hasAtomicSoftTabs()).toBe(true) }) + it('enables or disables line numbers based on the config', async function () { + editor.update({showLineNumbers: true}) + expect(editor.showLineNumbers).toBe(true) + + atom.config.set('editor.showLineNumbers', false) + registry.maintainConfig(editor) + await initialPackageActivation + expect(editor.showLineNumbers).toBe(false) + + atom.config.set('editor.showLineNumbers', true) + expect(editor.showLineNumbers).toBe(true) + }) + it('sets the invisibles based on the config', async function () { const invisibles1 = {'tab': 'a', 'cr': false, eol: false, space: false} const invisibles2 = {'tab': 'b', 'cr': false, eol: false, space: false} diff --git a/src/text-editor-registry.js b/src/text-editor-registry.js index 2b9494c10..bda3712e7 100644 --- a/src/text-editor-registry.js +++ b/src/text-editor-registry.js @@ -12,6 +12,7 @@ const EDITOR_PARAMS_BY_SETTING_KEY = [ ['editor.tabLength', 'tabLength'], ['editor.invisibles', 'invisibles'], ['editor.showIndentGuide', 'showIndentGuide'], + ['editor.showLineNumbers', 'showLineNumbers'], ['editor.softWrap', 'softWrapped'], ['editor.softWrapHangingIndent', 'softWrapHangingIndentLength'], ['editor.softWrapAtPreferredLineLength', 'softWrapAtPreferredLineLength'],