From ffe2fe2ec81d046ad4e9df37239ede28277ad5b9 Mon Sep 17 00:00:00 2001 From: Arun Bose Date: Thu, 16 Jan 2025 12:11:51 +0530 Subject: [PATCH] feat: go to line will accept :ln:col format along with :ln,col (#2061) --- src/search/QuickOpen.js | 2 +- test/spec/QuickOpen-integ-test.js | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/search/QuickOpen.js b/src/search/QuickOpen.js index 473465a93e..207a3dc279 100644 --- a/src/search/QuickOpen.js +++ b/src/search/QuickOpen.js @@ -89,7 +89,7 @@ define(function (require, exports, module) { * @private * @const {RegExp} */ - var CURSOR_POS_EXP = new RegExp(":([^,]+)?(,(.+)?)?"); + var CURSOR_POS_EXP = new RegExp(":([^,:]+)?([,:](.+)?)?"); /** * Current plugin diff --git a/test/spec/QuickOpen-integ-test.js b/test/spec/QuickOpen-integ-test.js index 8f06e98524..78a7918d4f 100644 --- a/test/spec/QuickOpen-integ-test.js +++ b/test/spec/QuickOpen-integ-test.js @@ -182,5 +182,21 @@ define(function (require, exports, module) { it("can directly open a file in a given line and column, centering that line on the screen", async function () { await quickOpenTest("lines:150,20", null, "lotsOfLines.html", 150, 20); }); + + it("can open a file and jump to a line and column with no space after comma", async function () { + await quickOpenTest("lines", ":50,20", "lotsOfLines.html", 50, 20); + }); + + it("can open a file and jump to a line and column with space after comma", async function () { + await quickOpenTest("lines", ":50, 20", "lotsOfLines.html", 50, 20); + }); + + it("can directly open a file with line:column format", async function () { + await quickOpenTest("lines:150:20", null, "lotsOfLines.html", 150, 20); + }); + + it("can directly open a file with line:column format and spaces", async function () { + await quickOpenTest("lines:150: 20", null, "lotsOfLines.html", 150, 20); + }); }); });