Also yank port number

This commit is contained in:
Martin Tournoij 2015-06-04 13:20:39 +02:00
parent 0132bea42b
commit d60d4d756c
2 changed files with 6 additions and 4 deletions

View File

@ -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

View File

@ -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(