Make gptel-rewrite text replacement preserve evaporative overlays #512
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I am working on gptel integration into my extension.
gptel-rewrite is very nice and already does a lot of work such as adding the ability to diff/ediff changes. Though most of the functions are internal to gptel, I am planning, for now, to use
gptel--rewrite-dispatch
to create the overlays, until a better solution.I've played around with it and it integrates very nicely, except for one issue: since I am using pre-existing overlays (not in any way related to the overlays gptel-rewrite creates), they are deleted because they have
evaporate
set to true when gptel-rewrite replaces the accepted text.To circumvent this, I made the text replacement unobtrusive, by first inserting the new text, then deleting the old, instead of vice versa.
Besides the changes of convenience for my extension, it seems, to me, to also be desirable behavior, but I'll leave you to judge. My only concern is that it goes against some sort of standard convention that replacement always means total deletion and insertion.