InlineEdit: Switch to using native jump-to-line addon The feature request to add native jump-to-line dialog to CodeMirror: [1] was solved in context of this PR: [2]. So that now we can switch from native and ugly Window#prompt() to nice looking CodeMirror addon. Test Plan: - Open change editor - Type Alt-G|Ctrl-L|Cmd-L - Jump to line dialog appears - Type the line number: 42 and hit enter - Confirm that the cursor is jumped to line 42 [1] https://github.com/codemirror/CodeMirror/issues/3030 [2] https://github.com/codemirror/CodeMirror/pull/3682 Change-Id: Ic9b889ea1efe26b3a19c5e885f1668009acc12ad
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/editor/EditScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/editor/EditScreen.java index a546c62..670b5c8 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/editor/EditScreen.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/editor/EditScreen.java
@@ -257,20 +257,7 @@ return new Runnable() { @Override public void run() { - String n = Window.prompt(EditConstants.I.gotoLineNumber(), ""); - if (n != null) { - try { - int line = Integer.parseInt(n); - line--; - if (line >= 0) { - cm.scrollToLine(line); - } - } catch (NumberFormatException e) { - // ignore non valid numbers - // We don't want to popup another ugly dialog just to say - // "The number you've provided is invalid, try again" - } - } + cm.execCommand("jumpToLine"); } }; }
diff --git a/lib/codemirror/cm.defs b/lib/codemirror/cm.defs index 9677058..39c4f09 100644 --- a/lib/codemirror/cm.defs +++ b/lib/codemirror/cm.defs
@@ -19,6 +19,7 @@ 'edit/trailingspace.js', 'scroll/annotatescrollbar.js', 'scroll/simplescrollbars.js', + 'search/jump-to-line.js', 'search/matchesonscrollbar.js', 'search/searchcursor.js', 'search/search.js',