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
Description
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.
-
But not fire when compactedChanges length become 0 in"" to "" change
At least I noticed select-list's spec was broken by this change here.
Reproduce
- Running following code in chrome-dev console.
- 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
Labels
No labels