Marker::copy question


Marker::copy is here …

I’m trying to clone a marker and even though I’m looking at the code and docs I can’t figure out how to do this. What are the properties that it wants as an arg? If I call copy with no properties it returns null. Is this not a clone operation?


Yep, it looks like there’s a problem with this method, whatever property I pass the result is always undefined and no markers are created. However I succeed to copy a buffer marker based on the example I found in the buffer marker’s spec:

> m.copy({invalidate: 'never'})
> m.bufferMarker.copy({invalidate: 'never'})
Marker {manager: Object, id: 675, range: Range, tailed: true, reversed: false…}
Marker {manager: Object, id: 676, range: Range, tailed: true, reversed: false…}

Logically, if I understand the ::copy code, it should create a new marker with the same properties as the original except for the one you redefine in the argument (hence the properties argument). But the code in the atom marker (the display buffer’s marker) seems to be broken.


I added atom/atom issue


I did that, got a marker, and with my bad luck I can’t decorate it, Somewhere in the buffer or editor list of markers that marker doesn’t exist. I’m chasing the problem in core now.

Edit: I realized that it would be much easier to just copy it myself, which I will do.