Skip to content

Commit 2d4f03d

Browse files
committed
fix(commands): show line range in goto prompt
1 parent 8ba9632 commit 2d4f03d

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/lib/commands.js

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

146151
if (!res) return;
147152
const [lineStr, colStr] = String(res).split(".");
148-
const { editor } = editorManager;
149153
editor.gotoLine(lineStr, colStr);
150154
},
151155
async "new-file"() {

0 commit comments

Comments
 (0)