From 5c976d724bd97d86e6c8a98e0b8c23958c8375b3 Mon Sep 17 00:00:00 2001 From: kanikaa1234 Date: Fri, 8 Apr 2016 19:40:45 +0530 Subject: [PATCH 1/4] Fixes #1318 --- .gitignore | 1 + qutebrowser/browser/commands.py | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/.gitignore b/.gitignore index e1db4729d..de98a1034 100644 --- a/.gitignore +++ b/.gitignore @@ -30,4 +30,5 @@ __pycache__ /.testmondata /.hypothesis /prof +/venv TODO diff --git a/qutebrowser/browser/commands.py b/qutebrowser/browser/commands.py index 3cae6941c..a662c8465 100644 --- a/qutebrowser/browser/commands.py +++ b/qutebrowser/browser/commands.py @@ -440,10 +440,14 @@ class CommandDispatcher: window: Open the link in a new window. """ path = url.path() + #print (url.Qurl) + print (path) if not path or path == '/': raise cmdexc.CommandError("Can't go up!") new_path = posixpath.join(path, posixpath.pardir) + print (new_path) url.setPath(new_path) + url.setFragment('') self._open(url, tab, background, window) @cmdutils.register(instance='command-dispatcher', scope='window') From a2bcf80aaead828f6b0855455ac031cdb399caeb Mon Sep 17 00:00:00 2001 From: kanikaa1234 Date: Fri, 8 Apr 2016 20:51:07 +0530 Subject: [PATCH 2/4] Fixed the tests --- qutebrowser/browser/commands.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/qutebrowser/browser/commands.py b/qutebrowser/browser/commands.py index a662c8465..5141ed552 100644 --- a/qutebrowser/browser/commands.py +++ b/qutebrowser/browser/commands.py @@ -440,14 +440,11 @@ class CommandDispatcher: window: Open the link in a new window. """ path = url.path() - #print (url.Qurl) - print (path) if not path or path == '/': raise cmdexc.CommandError("Can't go up!") new_path = posixpath.join(path, posixpath.pardir) - print (new_path) url.setPath(new_path) - url.setFragment('') + url.setFragment(None) self._open(url, tab, background, window) @cmdutils.register(instance='command-dispatcher', scope='window') From fae005ab7f6a2177cb3a1b812d0963781dedcc27 Mon Sep 17 00:00:00 2001 From: kanikaa1234 Date: Tue, 19 Apr 2016 20:30:20 +0530 Subject: [PATCH 3/4] :navigate: command and test feature --- .gitignore | 1 + qutebrowser/browser/commands.py | 2 ++ tests/integration/features/navigate.feature | 5 +++++ 3 files changed, 8 insertions(+) diff --git a/.gitignore b/.gitignore index de98a1034..2bc5b3e7f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ __pycache__ +*.py~ *.pyc *.swp /build diff --git a/qutebrowser/browser/commands.py b/qutebrowser/browser/commands.py index 5141ed552..75883f7c6 100644 --- a/qutebrowser/browser/commands.py +++ b/qutebrowser/browser/commands.py @@ -428,7 +428,9 @@ class CommandDispatcher: new_url = urlutils.incdec_number(url, incdec, segments=segments) except urlutils.IncDecError as error: raise cmdexc.CommandError(error.msg) + url.setFragment(None) self._open(new_url, tab, background, window) + def _navigate_up(self, url, tab, background, window): """Helper method for :navigate when `where' is up. diff --git a/tests/integration/features/navigate.feature b/tests/integration/features/navigate.feature index e5fd20d52..b356e399c 100644 --- a/tests/integration/features/navigate.feature +++ b/tests/integration/features/navigate.feature @@ -38,6 +38,11 @@ Feature: Using :navigate And I run :navigate next Then the error "No forward links found!" should be shown + Scenario: Navigating to next page to a fragment + When I open data/navigate#fragment + And I run :navigate next + Then data/navigate/next.html should be loaded + # increment/decrement Scenario: Incrementing number in URL From 22ad416f352065a4ab58bd2c9dc3988877feedc9 Mon Sep 17 00:00:00 2001 From: kanikaa1234 Date: Sun, 24 Apr 2016 19:33:31 +0530 Subject: [PATCH 4/4] Addressing test --- qutebrowser/browser/commands.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qutebrowser/browser/commands.py b/qutebrowser/browser/commands.py index 75883f7c6..4937a3766 100644 --- a/qutebrowser/browser/commands.py +++ b/qutebrowser/browser/commands.py @@ -428,9 +428,9 @@ class CommandDispatcher: new_url = urlutils.incdec_number(url, incdec, segments=segments) except urlutils.IncDecError as error: raise cmdexc.CommandError(error.msg) - url.setFragment(None) + url.setFragment(None) + self._open(new_url, tab, background, window) - def _navigate_up(self, url, tab, background, window): """Helper method for :navigate when `where' is up.