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:
committed by
David Pursehouse
parent
1d23e4f717
commit
99d8d3c21f
@@ -257,20 +257,7 @@ public class EditScreen extends Screen {
|
|||||||
return new Runnable() {
|
return new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
String n = Window.prompt(EditConstants.I.gotoLineNumber(), "");
|
cm.execCommand("jumpToLine");
|
||||||
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"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ CM_ADDONS = [
|
|||||||
'edit/trailingspace.js',
|
'edit/trailingspace.js',
|
||||||
'scroll/annotatescrollbar.js',
|
'scroll/annotatescrollbar.js',
|
||||||
'scroll/simplescrollbars.js',
|
'scroll/simplescrollbars.js',
|
||||||
|
'search/jump-to-line.js',
|
||||||
'search/matchesonscrollbar.js',
|
'search/matchesonscrollbar.js',
|
||||||
'search/searchcursor.js',
|
'search/searchcursor.js',
|
||||||
'search/search.js',
|
'search/search.js',
|
||||||
|
|||||||
Reference in New Issue
Block a user