We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9520162 commit 441acf0Copy full SHA for 441acf0
content_scripts/mode_normal.js
@@ -152,11 +152,13 @@ const NormalModeCommands = {
152
}
153
154
// Pop path segments.
155
- if (c > 0 && url.pathname != "/") {
156
- url.pathname = url.pathname.split("/").slice(0, -c).join("/");
+ if (c > 0 && url.pathname !== "/") {
+ const initialSegments = url.pathname.substring(1).split("/");
157
+ const segments = initialSegments.slice(0, -c);
158
+ url.pathname = `/${segments.join("/")}`;
159
url.search = "";
160
url.hash = "";
- --c;
161
+ c -= initialSegments.length - segments.length;
162
163
164
if (globalThis.location.href !== url.toString()) {
0 commit comments