mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
Honor the isLineNumberGutterVisible option
This commit is contained in:
committed by
Antonio Scandurra
parent
88b30bc4dc
commit
36f5262f40
@@ -257,6 +257,11 @@ describe('TextEditorComponent', () => {
|
||||
expect(element.offsetHeight).toBeGreaterThan(initialHeight)
|
||||
})
|
||||
|
||||
it('supports the isLineNumberGutterVisible parameter', () => {
|
||||
const {component, element, editor} = buildComponent({lineNumberGutterVisible: false})
|
||||
expect(element.querySelector('.line-number')).toBe(null)
|
||||
})
|
||||
|
||||
describe('mini editors', () => {
|
||||
it('adds the mini attribute', () => {
|
||||
const {element, editor} = buildComponent({mini: true})
|
||||
@@ -1351,6 +1356,7 @@ function buildComponent (params = {}) {
|
||||
if (params.mini != null) editorParams.mini = params.mini
|
||||
if (params.autoHeight != null) editorParams.autoHeight = params.autoHeight
|
||||
if (params.autoWidth != null) editorParams.autoWidth = params.autoWidth
|
||||
if (params.lineNumberGutterVisible != null) editorParams.lineNumberGutterVisible = params.lineNumberGutterVisible
|
||||
const editor = new TextEditor(editorParams)
|
||||
const component = new TextEditorComponent({
|
||||
model: editor,
|
||||
|
||||
@@ -240,11 +240,14 @@ class TextEditorComponent {
|
||||
}
|
||||
|
||||
renderLineNumberGutter () {
|
||||
const model = this.getModel()
|
||||
|
||||
if (!model.isLineNumberGutterVisible()) return null
|
||||
|
||||
if (this.currentFrameLineNumberGutterProps) {
|
||||
return $(LineNumberGutterComponent, this.currentFrameLineNumberGutterProps)
|
||||
}
|
||||
|
||||
const model = this.getModel()
|
||||
const maxLineNumberDigits = Math.max(2, model.getLineCount().toString().length)
|
||||
|
||||
if (this.measurements) {
|
||||
|
||||
Reference in New Issue
Block a user