Repository: atom/atom
File: src/text-editor.js (JavaScript)

Code before:
          if (value !== this.mini) {
            this.mini = value
            this.emitter.emit('did-change-mini', value)
            displayLayerParams.invisibles = this.getInvisibles()
            displayLayerParams.softWrapColumn = this.getSoftWrapColumn()
            displayLayerParams.showIndentGuides = this.doesShowIndentGuide()
            if (this.mini) {
              for (let decoration of this.cursorLineDecorations) { decoration.destroy() }
              this.cursorLineDecorations = null
            } else {
              this.decorateCursorLine()
            }
            if (this.component != null) {
              this.component.scheduleUpdate()
            }
          }
          break

        case 'placeholderText':
          if (value !== this.placeholderText) {
            this.placeholderText = value
            this.emitter.emit('did-change-placeholder-text', value)
          }
          break

        case 'lineNumberGutterVisible':
          if (value !== this.lineNumberGutterVisible) {
            if (value) {
              this.lineNumberGutter.show()
            } else {
              this.lineNumberGutter.hide()
            }
            this.emitter.emit('did-change-line-number-gutter-visible', this.lineNumberGutter.isVisible())
          }
          break

        case 'showIndentGuide':
          if (value !== this.showIndentGuide) {
            this.showIndentGuide = value
            displayLayerParams.showIndentGuides = this.doesShowIndentGuide()
          }
          break

        case 'showLineNumbers':
          if (value !== this.showLineNumbers) {
            this.showLineNumbers = value
            if (this.component != null) {
              this.component.scheduleUpdate()
            }
          }
          break

Review comment (suggestion):
Should not emit "modified state changed" event when it's really not changed.
If some feature need hook for this, fire distinct event like `did-set-read-only` and do manual work in this.


Code after:
        case 'mini':
          if (value !== this.mini) {
            this.mini = value
            this.emitter.emit('did-change-mini', value)
            displayLayerParams.invisibles = this.getInvisibles()
            displayLayerParams.softWrapColumn = this.getSoftWrapColumn()
            displayLayerParams.showIndentGuides = this.doesShowIndentGuide()
            if (this.mini) {
              for (let decoration of this.cursorLineDecorations) { decoration.destroy() }
              this.cursorLineDecorations = null
            } else {
              this.decorateCursorLine()
            }
            if (this.component != null) {
              this.component.scheduleUpdate()
            }
          }
          break

        case 'readOnly':
          if (value !== this.readOnly) {
            this.readOnly = value
            if (this.component != null) {
              this.component.scheduleUpdate()
            }
            this.buffer.emitModifiedStatusChanged(this.isModified())
          }
          break

        case 'placeholderText':
          if (value !== this.placeholderText) {
            this.placeholderText = value
            this.emitter.emit('did-change-placeholder-text', value)
          }
          break

        case 'lineNumberGutterVisible':
          if (value !== this.lineNumberGutterVisible) {
            if (value) {
              this.lineNumberGutter.show()
            } else {
              this.lineNumberGutter.hide()
            }
            this.emitter.emit('did-change-line-number-gutter-visible', this.lineNumberGutter.isVisible())
          }
          break

        case 'showIndentGuide':
          if (value !== this.showIndentGuide) {
            this.showIndentGuide = value
            displayLayerParams.showIndentGuides = this.doesShowIndentGuide()