Skip to content

Commit

Permalink
Change key bindings for folding in PGCodeMirror.
Browse files Browse the repository at this point in the history
By default code mirror uses Shift-Ctrl-F for find/replace
and Shift-Ctrl-G for find previous. These key bindings were
overwritten when folding was added.

This changes the fold binding to Shift-Ctrl-W and unfold all
to Shift-Ctrl-Q, so they no longer interfere with the find
replace key bindings.
  • Loading branch information
somiaj committed Oct 6, 2024
1 parent 137ed73 commit be48b2d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions htdocs/js/PGCodeMirror/pgeditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,12 @@
lineWrapping: true,
extraKeys: {
Tab: (cm) => cm.execCommand('insertSoftTab'),
'Shift-Ctrl-F': (cm) => cm.foldCode(cm.getCursor(), { scanUp: true }),
'Shift-Cmd-F': (cm) => cm.foldCode(cm.getCursor(), { scanUp: true }),
'Shift-Ctrl-W': (cm) => cm.foldCode(cm.getCursor(), { scanUp: true }),
'Shift-Cmd-W': (cm) => cm.foldCode(cm.getCursor(), { scanUp: true }),
'Shift-Ctrl-A': (cm) => CodeMirror.commands.foldAll(cm),
'Shift-Cmd-A': (cm) => CodeMirror.commands.foldAll(cm),
'Shift-Ctrl-G': (cm) => CodeMirror.commands.unfoldAll(cm),
'Shift-Cmd-G': (cm) => CodeMirror.commands.unfoldAll(cm)
'Shift-Ctrl-Q': (cm) => CodeMirror.commands.unfoldAll(cm),
'Shift-Cmd-Q': (cm) => CodeMirror.commands.unfoldAll(cm)
},
highlightSelectionMatches: { annotateScrollbar: true },
matchBrackets: true,
Expand Down
4 changes: 2 additions & 2 deletions templates/HelpFiles/InstructorPGProblemEditor.html.ep
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@
<dd class="list-group-item">
<%= maketext('This is where you edit the text of the problem template. Type Ctrl-Enter while this '
. 'window has focus to re-render the problem. Code folding is enabled either by clicking on '
. 'the triangles in the gutter next to line numbers or using the shortcut Shift-Ctrl-F. Folding '
. 'all regions can be accomplished with Shift-Ctrl-A and unfold all regions with Shift-Ctrl-G. '
. 'the triangles in the gutter next to line numbers or using the shortcut Shift-Ctrl-W. Folding '
. 'all regions can be accomplished with Shift-Ctrl-A and unfold all regions with Shift-Ctrl-Q. '
. 'Comments can be toggled with Ctrl-/.') =%>
</dd>
<dt><%= maketext('Text Editor Options') %></dt>
Expand Down

0 comments on commit be48b2d

Please sign in to comment.