Question

I'm using codemirror in Ruby mode, with the following includes:

<link rel="stylesheet" href="/codemirror/lib/codemirror.css">
<link rel="stylesheet" href="/codemirror/theme/ambiance.css">
<link rel="stylesheet" href="/codemirror/addon/dialog/dialog.css">
<script src="/codemirror/lib/codemirror.js"></script>
<script src="/codemirror/addon/edit/matchbrackets.js"></script>
<script src="/codemirror/mode/ruby/ruby.js"></script>
<script src="/codemirror/addon/search/search.js"></script>
<script src="/codemirror/addon/search/searchcursor.js"></script>
<script src="/codemirror/addon/dialog/dialog.js"></script>
<script src="/codemirror/addon/comment/comment.js"></script>
<script src="/codemirror/addon/edit/closebrackets.js"></script>

I bound the Cmd-/ and Ctrl-/ keys like so:

    'Cmd-/' : 'toggleComment',
    'Ctrl-/' : 'toggleComment'

The command works fine on a single line of Ruby (it comments/uncomments the line in toggle fashion). However when I select a block of code it only comments, but does not uncomment the block. Instead of uncommenting, it adds another layer of comment characters (# in Ruby).

Is this a bug? Is there anything I can do about it?

Was it helpful?

Solution

Indeed, a bug. See https://github.com/marijnh/CodeMirror/commit/9a50176800dfd9f4a5cdc19564a26381e71ed96f for a fix. Bugs are best reported on the issue tracker of that same github repository.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top