atom-archive / xray

An experimental next-generation Electron-based text editor
MIT License
8.48k stars 235 forks source link

[Memo] Adding a `Changed` file status. #151

Open probablycorey opened 5 years ago

probablycorey commented 5 years ago

When I change a file, the file entry status remains ‘Unchanged’. I can’t tell if a file has been modified unless we compare it to the original file contents. Is this something that could be added to the API?

as-cii commented 5 years ago

We think that this could be a good addition to the API. Naively, we could mark something as changed if there were any operations on the buffer. However, since these operations could cancel each other out, we actually still need to perform some kind of comparison which will end up being linear in the number of changes. This may perform better than a linear comparison of the contents of the previous and current buffer states however, so may be worth doing for convenience and optimality.

Our instinct is that ironing out issues related to resets should take precedence over this feature if you have a workaround.

probablycorey commented 5 years ago

Our instinct is that ironing out issues related to resets should take precedence over this feature if you have a workaround.

That sounds right to me too. Let's pick this up after resets is working.

nathansobo commented 5 years ago

We made some progress toward this in #154, but we'll leave it open since we don't detect operations which cancel each other out.