-
Notifications
You must be signed in to change notification settings - Fork 10
Inserting text in between adjacent markers makes them overlap #15
Comments
@lee-dohm This behaviour is the cause of atom/snippets#15, are you sure that |
SummaryI’ll try to extend ContextA ProposalI propose extending Ranges will be closed by default, i.e. without code changes they’ll keep their current behaviour of including (covering) the insertion points at both ends. This gives packages options to refine which points their markers and ranges include. Snippets can then create open/closed ranges, i.e. ranges that include the insertion point at the end but not at the start. That should solve atom/snippets#15. I’ll go ahead and try to implement this. In the meantime I welcome discussion about how we should handle this. |
Have you tried the |
If I understand If I insert a snippet That might be misunderstanding on my part though. |
Wouldn't a similar problem apply with a Range that had open endpoints? |
An open Range would be the same as an exclusive Range and would have the same problem. A left-open Range would exclude the beginning but not the end. It would have different problems (but, in my opinion, fewer and more contrived ones). |
Ideally I’d like if, given a snippet
Atom would distinguish the situations where I
But I don’t think we can do that by extending Range. |
@mkhl We could extend the |
@mkhl I've actually archived this repository because it's not in use. Maybe it would be good to open an issue on snippets describing the surface level problem or an issue on text-buffer proposing the feature. Unfortunately, I can't change course immediately to make this addition, but I do think you raise good points and it would be worthwhile to do once bigger issues are dealt with in our text layer. |
All repositories in the atom-archive organization are unmaintained and deprecated. Because of this, we are archiving this repository and closing all issues and pull requests. Thanks very much for your support and contributions! |
When we create two adjacent markers and insert text between them, that extends both markers and makes them overlap.
For example, given a buffer
(where
{}
denote a marker and|
denotes a cursor),entering
d
results inwith both markers now containing the
d
character.I think this is due to the initial situation being indistinguishable from (and being handled as)
in which the markers already overlap, just with no text in between them.
One way to encounter this situation is when expanding a snippet with adjacent placeholders like (in snippet syntax)
Replacing
one
withab
, say, results in these intermediate states (in the notation above):which means jumping to the second tab stop would mark the
b
we just entered at the first tab stop.I can see that there's no obvious "correct" approach to take here, so maybe this behaviour is fine? It seems like restriction on the capability of snippets though.
The text was updated successfully, but these errors were encountered: