fixup! fixup! incdec_number: add support for port

This commit is contained in:
Daniel Hahler 2018-01-24 22:21:22 +01:00
parent 9f14ae184f
commit 4f04c776c1
3 changed files with 8 additions and 4 deletions

View File

@ -638,9 +638,13 @@ class CommandDispatcher:
- `next`: Open a _next_ link. - `next`: Open a _next_ link.
- `up`: Go up a level in the current URL. - `up`: Go up a level in the current URL.
- `increment`: Increment the last number in the URL. - `increment`: Increment the last number in the URL.
Uses the link:settings.html#url.incdec_segments[url.incdec_segments] config option. Uses the
link:settings.html#url.incdec_segments[url.incdec_segments]
config option.
- `decrement`: Decrement the last number in the URL. - `decrement`: Decrement the last number in the URL.
Uses the link:settings.html#url.incdec_segments[url.incdec_segments] config option. Uses the
link:settings.html#url.incdec_segments[url.incdec_segments]
config option.
tab: Open in a new tab. tab: Open in a new tab.
bg: Open in a background tab. bg: Open in a background tab.

View File

@ -561,7 +561,8 @@ def incdec_number(url, incdec, count=1, segments=None):
# Order as they appear in a URL # Order as they appear in a URL
segment_modifiers = [ segment_modifiers = [
('host', url.host, url.setHost), ('host', url.host, url.setHost),
('port', lambda: str(url.port()) if url.port() > 0 else '', lambda x: url.setPort(int(x))), ('port', lambda: str(url.port()) if url.port() > 0 else '',
lambda x: url.setPort(int(x))),
('path', url.path, url.setPath), ('path', url.path, url.setPath),
('query', url.query, url.setQuery), ('query', url.query, url.setQuery),
('anchor', url.fragment, url.setFragment), ('anchor', url.fragment, url.setFragment),

View File

@ -624,7 +624,6 @@ class TestIncDecNumber:
def test_incdec_port(self): def test_incdec_port(self):
"""Test incdec_number with port.""" """Test incdec_number with port."""
base_url = QUrl('http://localhost:8000') base_url = QUrl('http://localhost:8000')
new_url = urlutils.incdec_number( new_url = urlutils.incdec_number(
base_url, 'increment', segments={'port'}) base_url, 'increment', segments={'port'})