From 9413eb54fdb3d93c71afc8434ccc785e13280c00 Mon Sep 17 00:00:00 2001 From: Jake Goulding Date: Wed, 25 Oct 2017 10:17:12 -0400 Subject: [PATCH] Reassign go to line to control/command-shift-l Closes #160 --- ui/frontend/AdvancedEditor.tsx | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/ui/frontend/AdvancedEditor.tsx b/ui/frontend/AdvancedEditor.tsx index 16e119556..750384686 100644 --- a/ui/frontend/AdvancedEditor.tsx +++ b/ui/frontend/AdvancedEditor.tsx @@ -53,16 +53,16 @@ class AdvancedEditor extends React.PureComponent { return ( + ref={this.trackEditor} + mode="rust" + keyboardHandler={keybinding} + theme={theme} + value={code} + onChange={onEditCode} + name="editor" + width="100%" + height="100%" + editorProps={{ $blockScrolling: true }} /> ); } @@ -82,6 +82,17 @@ class AdvancedEditor extends React.PureComponent { readOnly: true, }); + // The default keybinding of control/command-l interferes with + // the browser's "edit the location" keycommand which I think + // is way more common. + const gotoCommand = editor.commands.byName.gotoline; + gotoCommand.bindKey = { + win: 'Ctrl-Shift-L', + mac: 'Command-Shift-L', + }; + editor.commands.removeCommand(gotoCommand.name); + editor.commands.addCommand(gotoCommand); + editor.setOptions({ enableBasicAutocompletion: true, });