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
This commit is contained in:
David Ostrovsky 2016-02-10 07:53:09 +01:00 committed by David Pursehouse
parent 1d23e4f717
commit 99d8d3c21f
2 changed files with 2 additions and 14 deletions

View File

@ -257,20 +257,7 @@ public class EditScreen extends Screen {
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");
}
};
}

View File

@ -19,6 +19,7 @@ CM_ADDONS = [
'edit/trailingspace.js',
'scroll/annotatescrollbar.js',
'scroll/simplescrollbars.js',
'search/jump-to-line.js',
'search/matchesonscrollbar.js',
'search/searchcursor.js',
'search/search.js',