change is_pretty to pretty
This commit is contained in:
parent
7c8d5572f1
commit
37db251be7
|
|
@ -734,7 +734,7 @@ class CommandDispatcher:
|
|||
elif what in ['url', 'pretty-url']:
|
||||
url = self._current_url()
|
||||
pretty = what == 'pretty-url'
|
||||
s = urlutils.get_url_yank_text(url, is_pretty=pretty)
|
||||
s = urlutils.get_url_yank_text(url, pretty=pretty)
|
||||
what = 'URL' # For printing
|
||||
elif what == 'selection':
|
||||
def _selection_callback(s):
|
||||
|
|
|
|||
|
|
@ -237,7 +237,7 @@ class HintActions:
|
|||
sel = (context.target == Target.yank_primary and
|
||||
utils.supports_selection())
|
||||
|
||||
urlstr = urlutils.get_url_yank_text(url, is_pretty=False)
|
||||
urlstr = urlutils.get_url_yank_text(url, pretty=False)
|
||||
new_content = urlstr
|
||||
|
||||
# only second and consecutive yanks are to append to the clipboard
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ def _init_variable_replacements() -> Mapping[str, _ReplacementFunction]:
|
|||
'url:path': lambda tb: _url(tb).path(),
|
||||
'url:query': lambda tb: _url(tb).query(),
|
||||
'url:yank': lambda tb: urlutils.get_url_yank_text(_url(tb),
|
||||
is_pretty=False),
|
||||
pretty=False),
|
||||
'title': lambda tb: tb.widget.page_title(tb.widget.currentIndex()),
|
||||
'clipboard': lambda _: utils.get_clipboard(),
|
||||
'primary': lambda _: utils.get_clipboard(selection=True),
|
||||
|
|
|
|||
|
|
@ -443,8 +443,7 @@ class PromptContainer(QWidget):
|
|||
else:
|
||||
sel = False
|
||||
target = 'clipboard'
|
||||
url_str = urlutils.get_url_yank_text(QUrl(question.url),
|
||||
is_pretty=False)
|
||||
url_str = urlutils.get_url_yank_text(QUrl(question.url), pretty=False)
|
||||
utils.set_clipboard(url_str, sel)
|
||||
message.info("Yanked to {}: {}".format(target, url_str))
|
||||
|
||||
|
|
|
|||
|
|
@ -684,12 +684,12 @@ def widened_hostnames(hostname: str) -> Iterable[str]:
|
|||
hostname = hostname.partition(".")[-1]
|
||||
|
||||
|
||||
def get_url_yank_text(url: QUrl, *, is_pretty: bool) -> str:
|
||||
def get_url_yank_text(url: QUrl, *, pretty: bool) -> str:
|
||||
"""Get the text that should be yanked for the given URL."""
|
||||
flags = FormatOption.REMOVE_PASSWORD
|
||||
if url.scheme() == 'mailto':
|
||||
flags |= FormatOption.REMOVE_SCHEME
|
||||
if is_pretty:
|
||||
if pretty:
|
||||
flags |= FormatOption.DECODE_RESERVED
|
||||
else:
|
||||
flags |= FormatOption.ENCODED
|
||||
|
|
|
|||
|
|
@ -787,7 +787,7 @@ class TestParseJavascriptUrl:
|
|||
assert parsed == source
|
||||
|
||||
|
||||
@pytest.mark.parametrize('url, is_pretty, expected', [
|
||||
@pytest.mark.parametrize('url, pretty, expected', [
|
||||
(QUrl('https://example.com'), False, 'https://example.com'),
|
||||
(QUrl('https://example.com/page'), False, 'https://example.com/page'),
|
||||
(QUrl('ftp://example.com'), False, 'ftp://example.com'),
|
||||
|
|
@ -803,8 +803,8 @@ class TestParseJavascriptUrl:
|
|||
(QUrl('https://example.com/?pipe=%7C'), False, 'https://example.com/?pipe=%7C'),
|
||||
(QUrl('https://example.com/?pipe=%7C'), True, 'https://example.com/?pipe=|'),
|
||||
])
|
||||
def test_get_url_yank_text(url, is_pretty, expected):
|
||||
assert urlutils.get_url_yank_text(url, is_pretty=is_pretty) == expected
|
||||
def test_get_url_yank_text(url, pretty, expected):
|
||||
assert urlutils.get_url_yank_text(url, pretty=pretty) == expected
|
||||
|
||||
|
||||
class TestWiden:
|
||||
|
|
|
|||
Loading…
Reference in New Issue