codemirror / CodeMirror-v1

An editable-iframe based code editor in JavaScript. See https://github.com/marijnh/CodeMirror for the currently maintained version
http://codemirror.net/
Other
362 stars 63 forks source link

unable to get separate history for multiple instances of codemirror #62

Closed ananyasen closed 12 years ago

ananyasen commented 12 years ago

Hi,

I am trying to have multiple codemirror editors in the same html document. I am using Codemirror Version: 2.2 The way I am getting the different instances of codemirror is :

            var myCodeMirror = CodeMirror.fromTextArea(myTextArea);

However I see that the history is shared between the different instances. In the codemirror.js I see that the instance does not get a new history object.

I need to be able to track the history of each codemirror instance separately. Is there a way I can do that? Is there a different way of instantiating codemirror so that I can get a separate history per instance?

Will appreciate any help on this.

Thanks, Ananya

ananyasen commented 12 years ago

After stepping through codemirror.js a bit more I do see that, the instance does get a new instance of the History object.

However, when I do a codemirrorInstance.historySize() on the different instances, I see that history of one instance is getting updated even if I do text edits on a different codemirror editor instance.

Am I missing something here?

Thanks Ananya

marijnh commented 12 years ago

I assume you're using CodeMirror version 2? That's at https://github.com/marijnh/CodeMirror2/

Anyway, I can not reproduce this, and it seems very unlikely behaviour -- there's nothing shared about history objects. Could you double check that you're testing the right thing?

marijnh commented 12 years ago

Oh, I see you also opened an issue on the other repository. Closing this one.

ananyasen commented 12 years ago

Ok thanks.

On Wed, Feb 8, 2012 at 11:26 AM, Marijn Haverbeke < reply@reply.github.com

wrote:

Oh, I see you also opened an issue on the other repository. Closing this one.


Reply to this email directly or view it on GitHub: https://github.com/marijnh/CodeMirror/issues/62#issuecomment-3874164