Skip to content

Commit

Permalink
fix: merge subs.add in Minimap
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya committed Jan 17, 2021
1 parent 56b6d3e commit 5a9ff08
Showing 1 changed file with 47 additions and 38 deletions.
85 changes: 47 additions & 38 deletions lib/minimap.js
Original file line number Diff line number Diff line change
Expand Up @@ -469,46 +469,55 @@ export default class Minimap {
const subs = new CompositeDisposable()
const opts = { scope: this.textEditor.getRootScopeDescriptor() }

subs.add(atom.config.observe('editor.scrollPastEnd', opts, (scrollPastEnd) => {
this.scrollPastEnd = scrollPastEnd
this.adapter.scrollPastEnd = this.scrollPastEnd
this.emitter.emit('did-change-config')
}))
subs.add(atom.config.observe('minimap.charHeight', opts, (configCharHeight) => {
this.configCharHeight = configCharHeight
this.updateScrollTop()
this.emitter.emit('did-change-config')
}))
subs.add(atom.config.observe('minimap.charWidth', opts, (configCharWidth) => {
this.configCharWidth = configCharWidth
this.updateScrollTop()
this.emitter.emit('did-change-config')
}))
subs.add(atom.config.observe('minimap.interline', opts, (configInterline) => {
this.configInterline = configInterline
this.updateScrollTop()
this.emitter.emit('did-change-config')
}))
subs.add(atom.config.observe('minimap.independentMinimapScroll', opts, (independentMinimapScroll) => {
this.independentMinimapScroll = independentMinimapScroll
this.updateScrollTop()
}))
subs.add(atom.config.observe('minimap.scrollSensitivity', opts, (scrollSensitivity) => {
this.scrollSensitivity = scrollSensitivity
}))
subs.add(atom.config.observe('minimap.redrawDelay', opts, (redrawDelay) => {
this.redrawDelay = redrawDelay
}))
// cdprr is shorthand for configDevicePixelRatioRounding
subs.add(atom.config.observe(
'minimap.devicePixelRatioRounding',
opts,
(cdprr) => {
this.configDevicePixelRatioRounding = cdprr
subs.add(
atom.config.observe('editor.scrollPastEnd', opts, (scrollPastEnd) => {
this.scrollPastEnd = scrollPastEnd
this.adapter.scrollPastEnd = this.scrollPastEnd
this.emitter.emit('did-change-config')
}),

atom.config.observe('minimap.charHeight', opts, (configCharHeight) => {
this.configCharHeight = configCharHeight
this.updateScrollTop()
this.emitter.emit('did-change-config')
}
))
}),

atom.config.observe('minimap.charWidth', opts, (configCharWidth) => {
this.configCharWidth = configCharWidth
this.updateScrollTop()
this.emitter.emit('did-change-config')
}),

atom.config.observe('minimap.interline', opts, (configInterline) => {
this.configInterline = configInterline
this.updateScrollTop()
this.emitter.emit('did-change-config')
}),

atom.config.observe('minimap.independentMinimapScroll', opts, (independentMinimapScroll) => {
this.independentMinimapScroll = independentMinimapScroll
this.updateScrollTop()
}),

atom.config.observe('minimap.scrollSensitivity', opts, (scrollSensitivity) => {
this.scrollSensitivity = scrollSensitivity
}),

atom.config.observe('minimap.redrawDelay', opts, (redrawDelay) => {
this.redrawDelay = redrawDelay
}),
// cdprr is shorthand for configDevicePixelRatioRounding

atom.config.observe(
'minimap.devicePixelRatioRounding',
opts,
(cdprr) => {
this.configDevicePixelRatioRounding = cdprr
this.updateScrollTop()
this.emitter.emit('did-change-config')
}
)
)

return subs
}
Expand Down

0 comments on commit 5a9ff08

Please sign in to comment.