Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unify trim/delete/insert events #1946

Closed
PerBothner opened this issue Feb 16, 2019 · 1 comment
Closed

unify trim/delete/insert events #1946

PerBothner opened this issue Feb 16, 2019 · 1 comment

Comments

@PerBothner
Copy link
Contributor

I believe various issues would be simplified if we unified trim, delete, and insert events on a Buffer's lines. Most obviously, a trim is just a delete where the event index is 0. Similarly, an insert can be treated as a delete with a negative amount. I believe any code that needs to handle one of these events needs to handle them all - just look at at the code for Buffer.addMarker.

Also notice the ElementInsert.put method (in Buffer.ts) in my sixel pull request #1940.

Not sure whether to call the unified event 'delete' or come up with a more neutral name.

I noticed that the selection is discarded when the window is resized. That is a symptom of not handling these events in a unified manner: The SelectionManager watches for trim events, but does not handle delete or insert events. That should be fixed.

A related issue is that deleteLines/insertLines/eraseInDisplay should perhaps also signal a delete event. I need something similar so images (sixel and otherwise) can get disposed when appropriate.

There will some compatibility problems. Addons that have trim handlers will have to be updated. It seems possible to kludge it so that old trim handlers are called when the index is 0.

PerBothner added a commit to PerBothner/xterm.js that referenced this issue Feb 19, 2019
PerBothner added a commit to PerBothner/xterm.js that referenced this issue Feb 19, 2019
@Tyriar
Copy link
Member

Tyriar commented Mar 8, 2019

I noticed that the selection is discarded when the window is resized. That is a symptom of not handling these events in a unified manner: The SelectionManager watches for trim events, but does not handle delete or insert events. That should be fixed.

I can't think of a way to actually hit this as an end user, please create another issue if you have a repro.

I did hit this when trying to repro though #1963

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants