SublimeText / ElasticTabstops

Tab characters automatically adjust to keep adjacent lines aligned.
https://github.com/SublimeText/ElasticTabstops
67 stars 6 forks source link

Debounce mod events to avoid being blocked on each keypress (esp. at large vertical blocks) #19

Open eugenesvk opened 1 year ago

eugenesvk commented 1 year ago

This PR adds debouncing to avoid being blocked on each editing keypress: While editing large vertical blocks the plugin struggles to do a lot of inserts needed to vertically align many lines. This makes typing close to impossible since the plugin tries to realign on every width-changing edit. With debouncing, the realignment only starts after a user-configurable delay has passed after the last edit/selection change operation, so it doesn't block continuous typing

I've tried the async alternative, which would also have solved this issue even better (as then you'd have no blocking at all and could continue to type while all the other lines are being aligned in the background), but then various editing operations affect the lines being aligned (e.g., while deleting a char in line 1 while the async operations is aligning line 50, you could accidentally delete something in line 50) Do you know if it's possible to restructure your plugin somehow to avoid live edits to affect subsequent lines directly?

P.S.