Custom entries in undo history

For Brackets, we’d like to add custom entries to the undo history as we plan to include a switch for CRLF/LF line endings.
I don’t think that’s possible right now (as the line endings are, from what I can tell, not part of the CodeMirror document, but of our wrapper).

So my question now is, is there a way to add history entries that can be handled on our side, maybe even a hack?

Thanks, Marcel

There is no such thing as pluggable/abstract history events. But here’s a hack that might work: http://jsbin.com/joyihasoyu/edit?js,output . Note that that code leaks (if the history overflows and starts dropping old events, our fake events don’t get dropped) and doesn’t handle redo at all, but it might show a good starting point.