abe33 / abe33/atom-tablr

Changes to TextEditor.onDidChange and TextBuffer.onDidChange coming in Atom 1.23

Đang mở
#95 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
CoffeeScript
Star
163
Fork
44
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

Hi! Thanks for maintaining the tablr package!

In Atom v1.23, we will [some](https://github.com/atom/text-buffer/pull/273) [changes](https://github.com/atom/text-buffer/pull/274) that may affect your package.

The methods `TextEditor.onDidChange` and `TextBuffer.onDidChange` will now call their callbacks *less frequently*. Previously, these callbacks would get called once for each individual change to the buffer. So if you had 5 cursors and typed a character, they would get called 5 times. Now, they will only get called once, and the event that is passed to them will contain information about *all 5* of the changes that have occurred.

The same properties that have always existed on the `TextBuffer.onDidChange` events (`oldRange`, `newRange`, `oldText`, and `newText`) will still be there, and they will now reflect the sum of *all* changes that have occurred. But now there will be an additional property called `changes`, which will contain an array of more fine-grained objects describing the *individual* changes. We encourage you to use this property instead of the old ones.

#### Effects on this package

It looks like this package calls the changed methods in the following places:

* `TextEditor.onDidChange`
* [here](https://github.com/abe33/atom-tablr/blob/3e8c2b8bd857a362214568cd249a7ff941dc49d6/lib/csv-editor-form-element.js#L279)

We found these calls using a regex search, so this list might be incomplete, and it might contain some false positives.

#### What to do about the change

It is likely that you do not need to do anything. The old event properties will continue to work.

However, you may be able to handle changes more accurately and efficiently by using the `changes` field of the events rather than the old properties. The `changes` field does not exist in Atom 1.22 unless you use the `TextBuffer.onDidChangeText` method. In Atom 1.23 and above though, `.onDidChange` and `.onDidChangeText` will become identical, having both the old properties and the new `changes` property.

Please let me know if you have any questions. I would be happy to help!

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.