Skip to content

Commit 5a9ff08

Browse files
committed
fix: merge subs.add in Minimap
1 parent 56b6d3e commit 5a9ff08

File tree

1 file changed

+47
-38
lines changed

1 file changed

+47
-38
lines changed

lib/minimap.js

Lines changed: 47 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -469,46 +469,55 @@ export default class Minimap {
469469
const subs = new CompositeDisposable()
470470
const opts = { scope: this.textEditor.getRootScopeDescriptor() }
471471

472-
subs.add(atom.config.observe('editor.scrollPastEnd', opts, (scrollPastEnd) => {
473-
this.scrollPastEnd = scrollPastEnd
474-
this.adapter.scrollPastEnd = this.scrollPastEnd
475-
this.emitter.emit('did-change-config')
476-
}))
477-
subs.add(atom.config.observe('minimap.charHeight', opts, (configCharHeight) => {
478-
this.configCharHeight = configCharHeight
479-
this.updateScrollTop()
480-
this.emitter.emit('did-change-config')
481-
}))
482-
subs.add(atom.config.observe('minimap.charWidth', opts, (configCharWidth) => {
483-
this.configCharWidth = configCharWidth
484-
this.updateScrollTop()
485-
this.emitter.emit('did-change-config')
486-
}))
487-
subs.add(atom.config.observe('minimap.interline', opts, (configInterline) => {
488-
this.configInterline = configInterline
489-
this.updateScrollTop()
490-
this.emitter.emit('did-change-config')
491-
}))
492-
subs.add(atom.config.observe('minimap.independentMinimapScroll', opts, (independentMinimapScroll) => {
493-
this.independentMinimapScroll = independentMinimapScroll
494-
this.updateScrollTop()
495-
}))
496-
subs.add(atom.config.observe('minimap.scrollSensitivity', opts, (scrollSensitivity) => {
497-
this.scrollSensitivity = scrollSensitivity
498-
}))
499-
subs.add(atom.config.observe('minimap.redrawDelay', opts, (redrawDelay) => {
500-
this.redrawDelay = redrawDelay
501-
}))
502-
// cdprr is shorthand for configDevicePixelRatioRounding
503-
subs.add(atom.config.observe(
504-
'minimap.devicePixelRatioRounding',
505-
opts,
506-
(cdprr) => {
507-
this.configDevicePixelRatioRounding = cdprr
472+
subs.add(
473+
atom.config.observe('editor.scrollPastEnd', opts, (scrollPastEnd) => {
474+
this.scrollPastEnd = scrollPastEnd
475+
this.adapter.scrollPastEnd = this.scrollPastEnd
476+
this.emitter.emit('did-change-config')
477+
}),
478+
479+
atom.config.observe('minimap.charHeight', opts, (configCharHeight) => {
480+
this.configCharHeight = configCharHeight
508481
this.updateScrollTop()
509482
this.emitter.emit('did-change-config')
510-
}
511-
))
483+
}),
484+
485+
atom.config.observe('minimap.charWidth', opts, (configCharWidth) => {
486+
this.configCharWidth = configCharWidth
487+
this.updateScrollTop()
488+
this.emitter.emit('did-change-config')
489+
}),
490+
491+
atom.config.observe('minimap.interline', opts, (configInterline) => {
492+
this.configInterline = configInterline
493+
this.updateScrollTop()
494+
this.emitter.emit('did-change-config')
495+
}),
496+
497+
atom.config.observe('minimap.independentMinimapScroll', opts, (independentMinimapScroll) => {
498+
this.independentMinimapScroll = independentMinimapScroll
499+
this.updateScrollTop()
500+
}),
501+
502+
atom.config.observe('minimap.scrollSensitivity', opts, (scrollSensitivity) => {
503+
this.scrollSensitivity = scrollSensitivity
504+
}),
505+
506+
atom.config.observe('minimap.redrawDelay', opts, (redrawDelay) => {
507+
this.redrawDelay = redrawDelay
508+
}),
509+
// cdprr is shorthand for configDevicePixelRatioRounding
510+
511+
atom.config.observe(
512+
'minimap.devicePixelRatioRounding',
513+
opts,
514+
(cdprr) => {
515+
this.configDevicePixelRatioRounding = cdprr
516+
this.updateScrollTop()
517+
this.emitter.emit('did-change-config')
518+
}
519+
)
520+
)
512521

513522
return subs
514523
}

0 commit comments

Comments
 (0)