Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

'did-change-text' event is not fired on empty("") to empty("") change after PR#274 #291

Open
@t9md

Description

@t9md

@maxbrunsfeld

After PR #274, empty("") to empty("") text change no longer fire did-change-text.
This seems to be a bit confusing since non empty same text change still fire did-change-text(e.g. "abc" to "abc").
And noticed this change breaks at least select-list's test-spec.
Does this change intentional?

Impact

Some pkg feature assuming editor.setText("") always fire editor.onDidChange event, but this is no longer true after #274.

At least I noticed select-list's spec was broken by this change here.

Reproduce

  1. Running following code in chrome-dev console.
  2. Result is different between v1.23.0 and later.
  • Atom-v1.23.0, change event fired for both "abc" to "abc" and empty "" to empty "".
  • later version: change event fired for "abc" to "abc" but not fired for empty "" to empty "".
async function test() {
  const editor = await atom.workspace.open("")

  console.log('abc to abc change')
  {
    editor.setText("abc")
    const disposable = editor.onDidChange(change => {
      disposable.dispose()
      console.log("Fired", change);
    })
    editor.setText("abc")
  }

  console.log('empty to empty change')
  {
    editor.setText("")
    const disposable = editor.onDidChange(change => {
      disposable.dispose()
      console.log("Fired", change);
    })
    editor.setText("")
  }
}

test()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions