Skip to content

Commit 61aca01

Browse files
authored
fix(commands): show line range in goto prompt (#1983)
1 parent 8ba9632 commit 61aca01

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/lib/commands.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,14 +139,17 @@ export default {
139139
showFileInfo(url);
140140
},
141141
async goto() {
142-
const res = await prompt(strings["enter line number"], "", "number", {
142+
const lastLine = editorManager.editor?.state?.doc?.lines;
143+
const message = lastLine
144+
? `${strings["enter line number"]} (1..${lastLine})`
145+
: strings["enter line number"];
146+
const res = await prompt(message, "", "number", {
143147
placeholder: "line.column",
144148
});
145149

146150
if (!res) return;
147151
const [lineStr, colStr] = String(res).split(".");
148-
const { editor } = editorManager;
149-
editor.gotoLine(lineStr, colStr);
152+
editorManager.editor.gotoLine(lineStr, colStr);
150153
},
151154
async "new-file"() {
152155
let filename = await prompt(strings["enter file name"], "", "filename", {

0 commit comments

Comments
 (0)