Skip to content

Commit e1dbf2e

Browse files
committed
Reassign go to line to control/command-shift-l
Closes #160
1 parent f49d56f commit e1dbf2e

File tree

1 file changed

+21
-10
lines changed

1 file changed

+21
-10
lines changed

ui/frontend/AdvancedEditor.tsx

+21-10
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,16 @@ class AdvancedEditor extends React.PureComponent<AdvancedEditorProps> {
5353

5454
return (
5555
<AceEditor
56-
ref={this.trackEditor}
57-
mode="rust"
58-
keyboardHandler={keybinding}
59-
theme={theme}
60-
value={code}
61-
onChange={onEditCode}
62-
name="editor"
63-
width="100%"
64-
height="100%"
65-
editorProps={{ $blockScrolling: true }} />
56+
ref={this.trackEditor}
57+
mode="rust"
58+
keyboardHandler={keybinding}
59+
theme={theme}
60+
value={code}
61+
onChange={onEditCode}
62+
name="editor"
63+
width="100%"
64+
height="100%"
65+
editorProps={{ $blockScrolling: true }} />
6666
);
6767
}
6868

@@ -82,6 +82,17 @@ class AdvancedEditor extends React.PureComponent<AdvancedEditorProps> {
8282
readOnly: true,
8383
});
8484

85+
// The default keybinding of control/command-l interferes with
86+
// the browser's "edit the location" keycommand which I think
87+
// is way more common.
88+
const gotoCommand = editor.commands.byName['gotoline'];
89+
gotoCommand.bindKey = {
90+
win: 'Ctrl-Shift-L',
91+
mac: 'Command-Shift-L',
92+
};
93+
editor.commands.removeCommand(gotoCommand.name);
94+
editor.commands.addCommand(gotoCommand);
95+
8596
editor.setOptions({
8697
enableBasicAutocompletion: true,
8798
});

0 commit comments

Comments
 (0)