specialize codemirror copystate function