From d60d4d756ce4e5cb45908d9940372e771d0b37dd Mon Sep 17 00:00:00 2001 From: Martin Tournoij Date: Thu, 4 Jun 2015 13:20:39 +0200 Subject: [PATCH] Also yank port number --- doc/help/commands.asciidoc | 2 +- qutebrowser/browser/commands.py | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/doc/help/commands.asciidoc b/doc/help/commands.asciidoc index e3dd81e62..104478c10 100644 --- a/doc/help/commands.asciidoc +++ b/doc/help/commands.asciidoc @@ -649,7 +649,7 @@ Yank the current URL/title to the clipboard or primary selection. ==== optional arguments * +*-t*+, +*--title*+: Yank the title instead of the URL. * +*-s*+, +*--sel*+: Use the primary selection instead of the clipboard. -* +*-d*+, +*--domain*+: Yank only the scheme & domain. +* +*-d*+, +*--domain*+: Yank only the scheme, domain, and port number. [[zoom]] === zoom diff --git a/qutebrowser/browser/commands.py b/qutebrowser/browser/commands.py index 9cb2a9991..9bfe81a10 100644 --- a/qutebrowser/browser/commands.py +++ b/qutebrowser/browser/commands.py @@ -702,15 +702,17 @@ class CommandDispatcher: Args: sel: Use the primary selection instead of the clipboard. title: Yank the title instead of the URL. - domain: Yank only the scheme & domain. + domain: Yank only the scheme, domain, and port number. """ clipboard = QApplication.clipboard() if title: s = self._tabbed_browser.page_title(self._current_index()) what = 'title' elif domain: - s = '{}://{}'.format(self._current_url().scheme(), - self._current_url().host()) + port = self._current_url().port() + s = '{}://{}{}'.format(self._current_url().scheme(), + self._current_url().host(), + ':' + str(port) if port > -1 else '') what = 'domain' else: s = self._current_url().toString(